integrating old bagel code back into the fold, and refactoring PGraphics classes

This commit is contained in:
benfry
2006-07-18 22:48:39 +00:00
parent e2aa863d96
commit 3b9a2e05ca
9 changed files with 2103 additions and 224 deletions
+248 -7
View File
@@ -1,7 +1,248 @@
#Mon Jul 17 22:49:52 EDT 2006
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
org.eclipse.jdt.core.compiler.compliance=1.3
org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
org.eclipse.jdt.core.compiler.source=1.3
#Tue Jul 18 18:46:40 EDT 2006
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
org.eclipse.jdt.core.compiler.compliance=1.3
org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
org.eclipse.jdt.core.compiler.source=1.3
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=82
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=1
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
org.eclipse.jdt.core.formatter.comment.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_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=2
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=80
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=2
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+4
View File
@@ -0,0 +1,4 @@
#Tue Jul 18 14:22:13 EDT 2006
eclipse.preferences.version=1
formatter_settings_version=8
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
+4 -2
View File
@@ -326,12 +326,14 @@ public interface PConstants {
static final int MY = 10;
static final int MZ = 11;
static final int SR = 12; // stroke colors
/** stroke argb values */
static final int SR = 12;
static final int SG = 13;
static final int SB = 14;
static final int SA = 15;
static final int SW = 16; // stroke weight
/** stroke weight */
static final int SW = 16;
// not used in rendering
// only used for calculating colors
+330 -47
View File
@@ -201,7 +201,7 @@ public abstract class PGraphics extends PImage implements PConstants {
// ........................................................
Path path;
//Path path;
// ........................................................
@@ -604,15 +604,6 @@ public abstract class PGraphics extends PImage implements PConstants {
// other stroke attributes are set in the initializers
// inside the class (see above, strokeWeight = 1 et al)
// if this fella is associated with an applet, then clear its background.
// if it's been created by someone else through createGraphics,
// they have to call background() themselves, otherwise everything gets
// a gray background (when just a transparent surface or an empty pdf
// is what's desired)
if (parent != null) {
background(204);
}
// init shape stuff
shape = 0;
@@ -631,14 +622,26 @@ public abstract class PGraphics extends PImage implements PConstants {
textAlign = LEFT;
textMode = MODEL;
// if this fella is associated with an applet, then clear its background.
// if it's been created by someone else through createGraphics,
// they have to call background() themselves, otherwise everything gets
// a gray background (when just a transparent surface or an empty pdf
// is what's desired)
if (parent != null) {
background(204);
}
defaultsInited = true;
}
/*
protected void flush() {
// no-op, mostly for P3D to write sorted stuff
}
*/
//////////////////////////////////////////////////////////////
@@ -666,6 +669,7 @@ public abstract class PGraphics extends PImage implements PConstants {
hints[which] = true;
}
/**
* Disable a hint.
*/
@@ -673,6 +677,7 @@ public abstract class PGraphics extends PImage implements PConstants {
hints[which] = false;
}
//////////////////////////////////////////////////////////////
@@ -708,7 +713,8 @@ public abstract class PGraphics extends PImage implements PConstants {
* the code and maintain it. for beta, the latter is most important so
* that's how things are implemented.
*/
public void beginShape(int kind) {
abstract public void beginShape(int kind);
/*
shape = kind;
// reset vertex, line and triangle information
@@ -721,23 +727,72 @@ public abstract class PGraphics extends PImage implements PConstants {
//strokeChanged = false;
//fillChanged = false;
//normalChanged = false;
}
*/
public void normal(float nx, float ny, float nz) {
depthError("normal");
}
/**
* Set texture mode to either to use coordinates based on the IMAGE
* (more intuitive for new users) or NORMALIZED (better for advanced chaps)
*/
public void textureMode(int mode) {
depthError("textureMode");
this.textureMode = mode;
}
/**
* Set texture image for current shape.
* Needs to be called between @see beginShape and @see endShape
*
* @param image reference to a PImage object
*/
public void texture(PImage image) {
depthError("texture");
textureImage = image;
}
/**
* Set (U, V) coords for the next vertex in the current shape.
* This is ugly as its own function, and will (almost?) always be
* coincident with a call to vertex. As of beta, this was moved to
* the protected method you see here, and called from an optional
* param of and overloaded vertex().
* <p/>
* The parameters depend on the current textureMode. When using
* textureMode(IMAGE), the coordinates will be relative to the size
* of the image texture, when used with textureMode(NORMAL),
* they'll be in the range 0..1.
* <p/>
* Used by both PGraphics2D (for images) and PGraphics3D.
*/
protected void textureVertex(float u, float v) {
if (textureImage == null) {
throw new RuntimeException("need to set an image with texture() " +
"before using u and v coordinates");
}
if (textureMode == IMAGE) {
u /= (float) textureImage.width;
v /= (float) textureImage.height;
}
textureU = u;
textureV = v;
if (textureU < 0) textureU = 0;
else if (textureU > ONE) textureU = ONE;
if (textureV < 0) textureV = 0;
else if (textureV > ONE) textureV = ONE;
}
public void vertex(float x, float y) {
// eventually need to push a "default" setup down to this class
abstract public void vertex(float x, float y);
/*
splineVertexCount = 0;
//float vertex[];
@@ -872,35 +927,150 @@ public abstract class PGraphics extends PImage implements PConstants {
}
break;
}
*/
abstract public void vertex(float x, float y, float z);
abstract public void vertex(float x, float y, float u, float v);
abstract public void vertex(float x, float y, float z, float u, float v);
public void bezierVertex(float x2, float y2,
float x3, float y3,
float x4, float y4) {
bezierVertex(x2, y2, Float.MAX_VALUE,
x3, y3, Float.MAX_VALUE,
x4, y4, Float.MAX_VALUE);
}
/**
* See notes with the bezier() function.
*/
public void bezierVertex(float x2, float y2, float z2,
float x3, float y3, float z3,
float x4, float y4, float z4) {
if (shape != POLYGON) {
throw new RuntimeException("beginShape() and vertex() " +
"must be used before bezierVertex()");
}
if (splineVertexCount > 0) {
float vertex[] = splineVertices[splineVertexCount-1];
splineVertex(vertex[MX], vertex[MY], vertex[MZ], true);
} else if (vertexCount > 0) {
// make sure there's at least a call to vertex()
float vertex[] = vertices[vertexCount-1];
splineVertex(vertex[MX], vertex[MY], vertex[MZ], true);
} else {
throw new RuntimeException("A call to vertex() must be used " +
"before bezierVertex()");
}
splineVertex(x2, y2, z2, true);
splineVertex(x3, y3, z3, true);
splineVertex(x4, y4, z4, true);
}
/**
* See notes with the curve() function.
*/
public void curveVertex(float x, float y) {
splineVertex(x, y, Float.MAX_VALUE, false);
}
public void vertex(float x, float y, float z) {
depthErrorXYZ("vertex");
/**
* See notes with the curve() function.
*/
public void curveVertex(float x, float y, float z) {
splineVertex(x, y, z, false);
}
public void vertex(float x, float y, float u, float v) {
throw new RuntimeException("vertex() with u, v coordinates " +
"can only be used with OPENGL or P3D");
}
public void vertex(float x, float y, float z, float u, float v) {
throw new RuntimeException("vertex() with u, v coordinates " +
"can only be used with OPENGL or P3D");
}
public void bezierVertex(float x1, float y1,
float x2, float y2,
float x3, float y3) {
// if there hasn't yet been a call to vertex(), throw an error
// otherwise, draw a bezier segment to this point
protected void splineVertex(float x, float y, float z, boolean bezier) {
// to improve processing applet load times, don't allocate
// space for the vertex data until actual use
if (splineVertices == null) {
splineVertices = new float[DEFAULT_SPLINE_VERTICES][VERTEX_FIELD_COUNT];
}
// if more than 128 points, shift everything back to the beginning
if (splineVertexCount == DEFAULT_SPLINE_VERTICES) {
System.arraycopy(splineVertices[DEFAULT_SPLINE_VERTICES-3], 0,
splineVertices[0], 0, VERTEX_FIELD_COUNT);
System.arraycopy(splineVertices[DEFAULT_SPLINE_VERTICES-2], 0,
splineVertices[1], 0, VERTEX_FIELD_COUNT);
System.arraycopy(splineVertices[DEFAULT_SPLINE_VERTICES-1], 0,
splineVertices[2], 0, VERTEX_FIELD_COUNT);
splineVertexCount = 3;
}
float vertex[] = splineVertices[splineVertexCount];
vertex[MX] = x;
vertex[MY] = y;
if (fill) {
vertex[R] = fillR;
vertex[G] = fillG;
vertex[B] = fillB;
vertex[A] = fillA;
}
if (stroke) {
vertex[SR] = strokeR;
vertex[SG] = strokeG;
vertex[SB] = strokeB;
vertex[SA] = strokeA;
vertex[SW] = strokeWeight;
}
if (textureImage != null) {
vertex[U] = textureU;
vertex[V] = textureV;
}
// when the coords are Float.MAX_VALUE, then treat as a 2D curve
int dimensions = (x == Float.MAX_VALUE) ? 2 : 3;
if (dimensions == 3) {
vertex[MZ] = z;
vertex[NX] = normalX;
vertex[NY] = normalY;
vertex[NZ] = normalZ;
}
splineVertexCount++;
// draw a segment if there are enough points
if (splineVertexCount > 3) {
if (bezier) {
if ((splineVertexCount % 4) == 0) {
if (!bezierInited) bezier_init();
splineSegment(splineVertexCount-4,
splineVertexCount-4,
bezier_draw, dimensions,
bezierDetail);
}
} else { // catmull-rom curve (!bezier)
if (!curve_inited) curve_init();
splineSegment(splineVertexCount-4,
splineVertexCount-3,
curve_draw, dimensions,
curveDetail);
}
}
}
/*
protected void bezier_vertex(float x, float y) {
vertexCount = 0;
@@ -941,33 +1111,41 @@ public abstract class PGraphics extends PImage implements PConstants {
"LINE_LOOP and POLYGON shapes");
}
}
*/
/*
public void bezierVertex(float x1, float y1, float z1,
float x2, float y2, float z2,
float x3, float y3, float z3) {
depthErrorXYZ("bezierVertex");
}
*/
/**
* See notes with the curve() function.
*/
/*
public void curveVertex(float x, float y) {
//throw new RuntimeException("curveVertex() temporarily disabled");
// TODO get matrix setup happening
}
*/
/**
* See notes with the curve() function.
*/
/*
public void curveVertex(float x, float y, float z) {
depthErrorXYZ("curveVertex");
}
*/
public void endShape() {
abstract public void endShape();
/*
shape = 0;
switch (shape) {
@@ -986,6 +1164,7 @@ public abstract class PGraphics extends PImage implements PConstants {
break;
}
}
*/
@@ -1036,6 +1215,7 @@ public abstract class PGraphics extends PImage implements PConstants {
// STROKE/FILL/DRAW
/*
//protected void fill_shape(Shape s) {
protected void fill_shape(Path s) {
if (fill) {
@@ -1063,44 +1243,64 @@ public abstract class PGraphics extends PImage implements PConstants {
//graphics.draw(s);
}
}
*/
//////////////////////////////////////////////////////////////
// POINT
// SIMPLE SHAPES WITH ANALOGUES IN beginShape()
public void point(float x, float y) {
// TODO
beginShape(POINTS);
vertex(x, y);
endShape();
}
public void point(float x, float y, float z) {
depthErrorXYZ("point");
beginShape(POINTS);
vertex(x, y, z);
endShape();
}
public void line(float x1, float y1, float x2, float y2) {
// TODO
beginShape(LINES);
vertex(x1, y1);
vertex(x2, y2);
endShape();
}
public void line(float x1, float y1, float z1,
float x2, float y2, float z2) {
depthErrorXYZ("line");
beginShape(LINES);
vertex(x1, y1, z1);
vertex(x2, y2, z2);
endShape();
}
public void triangle(float x1, float y1, float x2, float y2,
float x3, float y3) {
// TODO
beginShape(TRIANGLES);
vertex(x1, y1);
vertex(x2, y2);
vertex(x3, y3);
endShape();
}
public void quad(float x1, float y1, float x2, float y2,
float x3, float y3, float x4, float y4) {
// TODO
beginShape(QUADS);
vertex(x1, y1);
vertex(x2, y2);
vertex(x3, y3);
vertex(x4, y4);
endShape();
}
@@ -1153,7 +1353,12 @@ public abstract class PGraphics extends PImage implements PConstants {
protected void rectImpl(float x1, float y1, float x2, float y2) {
// TODO write rect drawing function
beginShape(QUADS);
vertex(x1, y1);
vertex(x2, y1);
vertex(x2, y2);
vertex(x1, y2);
endShape();
}
@@ -1586,6 +1791,62 @@ public abstract class PGraphics extends PImage implements PConstants {
* for catmull-rom curves, the first control point (x2, y2, z2)
* is the first drawn point, and is accumulated to.
*/
protected void splineSegment(int offset, int start, float m[][],
int dimensions, int segments) {
float x1 = splineVertices[offset+0][MX];
float x2 = splineVertices[offset+1][MX];
float x3 = splineVertices[offset+2][MX];
float x4 = splineVertices[offset+3][MX];
float x0 = splineVertices[start][MX];
float y1 = splineVertices[offset+0][MY];
float y2 = splineVertices[offset+1][MY];
float y3 = splineVertices[offset+2][MY];
float y4 = splineVertices[offset+3][MY];
float y0 = splineVertices[start][MY];
float xplot1 = m[1][0]*x1 + m[1][1]*x2 + m[1][2]*x3 + m[1][3]*x4;
float xplot2 = m[2][0]*x1 + m[2][1]*x2 + m[2][2]*x3 + m[2][3]*x4;
float xplot3 = m[3][0]*x1 + m[3][1]*x2 + m[3][2]*x3 + m[3][3]*x4;
float yplot1 = m[1][0]*y1 + m[1][1]*y2 + m[1][2]*y3 + m[1][3]*y4;
float yplot2 = m[2][0]*y1 + m[2][1]*y2 + m[2][2]*y3 + m[2][3]*y4;
float yplot3 = m[3][0]*y1 + m[3][1]*y2 + m[3][2]*y3 + m[3][3]*y4;
// vertex() will reset splineVertexCount, so save it
int cvertexSaved = splineVertexCount;
if (dimensions == 3) {
float z1 = splineVertices[offset+0][MZ];
float z2 = splineVertices[offset+1][MZ];
float z3 = splineVertices[offset+2][MZ];
float z4 = splineVertices[offset+3][MZ];
float z0 = splineVertices[start][MZ];
float zplot1 = m[1][0]*z1 + m[1][1]*z2 + m[1][2]*z3 + m[1][3]*z4;
float zplot2 = m[2][0]*z1 + m[2][1]*z2 + m[2][2]*z3 + m[2][3]*z4;
float zplot3 = m[3][0]*z1 + m[3][1]*z2 + m[3][2]*z3 + m[3][3]*z4;
vertex(x0, y0, z0);
for (int j = 0; j < segments; j++) {
x0 += xplot1; xplot1 += xplot2; xplot2 += xplot3;
y0 += yplot1; yplot1 += yplot2; yplot2 += yplot3;
z0 += zplot1; zplot1 += zplot2; zplot2 += zplot3;
vertex(x0, y0, z0);
}
} else {
vertex(x0, y0);
for (int j = 0; j < segments; j++) {
x0 += xplot1; xplot1 += xplot2; xplot2 += xplot3;
y0 += yplot1; yplot1 += yplot2; yplot2 += yplot3;
vertex(x0, y0);
}
}
splineVertexCount = cvertexSaved;
}
/*
protected void spline2_segment(int offset, int start,
float m[][], int segments) {
float x1 = splineVertices[offset][MX];
@@ -1668,6 +1929,7 @@ public abstract class PGraphics extends PImage implements PConstants {
}
splineVertexCount = cvertexSaved;
}
*/
@@ -3391,13 +3653,21 @@ public abstract class PGraphics extends PImage implements PConstants {
"with P3D or OPENGL.");
}
protected void depthErrorXYZ(String method) {
throw new RuntimeException(method + "(x, y, z) can only be used with " +
"OPENGL or P3D, use " +
method + "(x, y) instead.");
}
protected void unavailableError(String methodStr) {
throw new RuntimeException(methodStr +
" is not available with this renderer");
}
//////////////////////////////////////////////////////////////
// COLOR MANIPULATION
@@ -3553,11 +3823,23 @@ public abstract class PGraphics extends PImage implements PConstants {
}
//////////////////////////////////////////////////////////////
// MATH
static final float sqrt(float a) {
return (float)Math.sqrt(a);
}
//////////////////////////////////////////////////////////////
// PATH
/*
class Path {
public void moveTo(float x, float y) { // ignore
@@ -3574,7 +3856,8 @@ public abstract class PGraphics extends PImage implements PConstants {
public void closePath() { // ignore
}
}
*/
//////////////////////////////////////////////////////////////
@@ -3611,7 +3894,7 @@ public abstract class PGraphics extends PImage implements PConstants {
public void endRaw() {
if (raw != null) {
// for 3D, need to flush any geometry that's been stored for sorting
raw.flush();
//raw.flush(); // this should be called by endDraw() instead
// just like beginDraw, this will have to be called because
// endDraw() will be happening outside of draw()
File diff suppressed because it is too large Load Diff
+8 -143
View File
@@ -356,7 +356,7 @@ public class PGraphics3D extends PGraphics {
public void endDraw() {
// no need to z order and render
// shapes were already rendered in endShape();
// (but can't return, since needs to update memimgsrc
// (but can't return, since needs to update memimgsrc)
if (hints[ENABLE_DEPTH_SORT]) {
flush();
}
@@ -488,21 +488,6 @@ public class PGraphics3D extends PGraphics {
}
/**
* Set texture mode to either to use coordinates based on the IMAGE
* (more intuitive for new users) or NORMALIZED (better for advanced chaps)
*/
public void textureMode(int mode) {
this.textureMode = mode;
}
/**
* Set texture image for current shape
* needs to be called between @see beginShape and @see endShape
*
* @param image reference to a PImage object
*/
public void texture(PImage image) {
textureImage = image;
@@ -527,7 +512,7 @@ public class PGraphics3D extends PGraphics {
public void vertex(float x, float y, float u, float v) {
texture_vertex(u, v);
textureVertex(u, v);
setup_vertex(x, y, 0);
}
@@ -539,7 +524,7 @@ public class PGraphics3D extends PGraphics {
public void vertex(float x, float y, float z,
float u, float v) {
texture_vertex(u, v);
textureVertex(u, v);
setup_vertex(x, y, z);
}
@@ -610,107 +595,6 @@ public class PGraphics3D extends PGraphics {
}
/**
* set UV coords for the next vertex in the current shape.
* this is ugly as its own fxn, and will almost always be
* coincident with a call to vertex, so it's being moved
* to be an optional param of and overloaded vertex()
*
* @param u U coordinate (X coord in image 0<=X<=image width)
* @param v V coordinate (Y coord in image 0<=Y<=image height)
*/
protected void texture_vertex(float u, float v) {
if (textureImage == null) {
throw new RuntimeException("need to set an image with texture() " +
"before using u and v coordinates");
}
if (textureMode == IMAGE) {
u /= (float) textureImage.width;
v /= (float) textureImage.height;
}
textureU = u;
textureV = v;
if (textureU < 0) textureU = 0;
else if (textureU > ONE) textureU = ONE;
if (textureV < 0) textureV = 0;
else if (textureV > ONE) textureV = ONE;
}
protected void spline_vertex(float x, float y, float z, boolean bezier) {
// allocate space for the spline vertices
// to improve processing applet load times, don't allocate until actual use
if (splineVertices == null) {
splineVertices = new float[DEFAULT_SPLINE_VERTICES][VERTEX_FIELD_COUNT];
}
// if more than 128 points, shift everything back to the beginning
if (splineVertexCount == DEFAULT_SPLINE_VERTICES) {
System.arraycopy(splineVertices[DEFAULT_SPLINE_VERTICES-3], 0,
splineVertices[0], 0, VERTEX_FIELD_COUNT);
System.arraycopy(splineVertices[DEFAULT_SPLINE_VERTICES-2], 0,
splineVertices[1], 0, VERTEX_FIELD_COUNT);
System.arraycopy(splineVertices[DEFAULT_SPLINE_VERTICES-1], 0,
splineVertices[2], 0, VERTEX_FIELD_COUNT);
splineVertexCount = 3;
}
float vertex[] = splineVertices[splineVertexCount];
vertex[MX] = x;
vertex[MY] = y;
vertex[MZ] = z;
if (fill) {
vertex[R] = fillR;
vertex[G] = fillG;
vertex[B] = fillB;
vertex[A] = fillA;
}
if (stroke) {
vertex[SR] = strokeR;
vertex[SG] = strokeG;
vertex[SB] = strokeB;
vertex[SA] = strokeA;
vertex[SW] = strokeWeight;
}
if (textureImage != null) {
vertex[U] = textureU;
vertex[V] = textureV;
}
vertex[NX] = normalX;
vertex[NY] = normalY;
vertex[NZ] = normalZ;
splineVertexCount++;
// draw a segment if there are enough points
if (splineVertexCount > 3) {
if (bezier) {
if ((splineVertexCount % 4) == 0) {
if (!bezierInited) bezier_init();
spline3_segment(splineVertexCount-4,
splineVertexCount-4,
bezier_draw,
bezierDetail);
}
} else { // catmull-rom curve (!bezier)
if (!curve_inited) curve_init();
spline3_segment(splineVertexCount-4,
splineVertexCount-3,
curve_draw,
curveDetail);
}
}
}
/**
* See notes with the bezier() function.
*/
@@ -729,35 +613,20 @@ public class PGraphics3D extends PGraphics {
float x4, float y4, float z4) {
if (splineVertexCount > 0) {
float vertex[] = splineVertices[splineVertexCount-1];
spline_vertex(vertex[MX], vertex[MY], vertex[MZ], true);
splineVertex(vertex[MX], vertex[MY], vertex[MZ], true);
} else if (vertexCount > 0) {
// make sure there's at least a call to vertex()
float vertex[] = vertices[vertexCount-1];
spline_vertex(vertex[MX], vertex[MY], vertex[MZ], true);
splineVertex(vertex[MX], vertex[MY], vertex[MZ], true);
} else {
throw new RuntimeException("A call to vertex() must be used " +
"before bezierVertex()");
}
spline_vertex(x2, y2, z2, true);
spline_vertex(x3, y3, z3, true);
spline_vertex(x4, y4, z4, true);
}
/**
* See notes with the curve() function.
*/
public void curveVertex(float x, float y) {
spline_vertex(x, y, 0, false);
}
/**
* See notes with the curve() function.
*/
public void curveVertex(float x, float y, float z) {
spline_vertex(x, y, z, false);
splineVertex(x2, y2, z2, true);
splineVertex(x3, y3, z3, true);
splineVertex(x4, y4, z4, true);
}
@@ -3994,10 +3863,6 @@ public class PGraphics3D extends PGraphics {
}
*/
private final float sqrt(float a) {
return (float)Math.sqrt(a);
}
private final float pow(float a, float b) {
return (float)Math.pow(a, b);
}
+41 -18
View File
@@ -130,12 +130,7 @@ public class PGraphicsJava2D extends PGraphics {
public void endDraw() {
// moving this back here (post-68) because of macosx thread problem
//mis.newPixels(pixels, cm, 0, width);
// need to mark pixels as needing an update, without calling
// its own endPixels, since that's crazy slow
//endPixels();
endPixels(); // mark pixels as changed
}
@@ -145,6 +140,31 @@ public class PGraphicsJava2D extends PGraphics {
// SHAPES
public void beginShape(int kind) {
//super.beginShape(kind);
shape = kind;
vertexCount = 0;
splineVertexCount = 0;
// set gpath to null, because when mixing curves and straight
// lines, vertexCount will be set back to zero, so vertexCount == 1
// is no longer a good indicator of whether the shape is new.
// this way, just check to see if gpath is null, and if it isn't
// then just use it to continue the shape.
gpath = null;
}
public void textureMode(int mode) {
unavailableError("textureMode(mode)");
}
public void texture(PImage image) {
unavailableError("texture(image)");
}
public void vertex(float x, float y) {
splineVertexCount = 0;
//float vertex[];
@@ -260,6 +280,21 @@ public class PGraphicsJava2D extends PGraphics {
break;
}
}
public void vertex(float x, float y, float u, float v) {
unavailableError("vertex(x, y, u, v");
}
public void vertex(float x, float y, float z) {
depthErrorXYZ("vertex");
}
public void vertex(float x, float y, float z, float u, float v) {
depthErrorXYZ("vertex");
}
public void bezierVertex(float x1, float y1,
@@ -348,18 +383,6 @@ public class PGraphicsJava2D extends PGraphics {
}
public void beginShape(int kind) {
super.beginShape(kind);
// set gpath to null, because when mixing curves and straight
// lines, vertexCount will be set back to zero, so vertexCount == 1
// is no longer a good indicator of whether the shape is new.
// this way, just check to see if gpath is null, and if it isn't
// then just use it to continue the shape.
gpath = null;
}
public void endShape() {
if (gpath != null) { // make sure something has been drawn
switch (shape) {
+2 -2
View File
@@ -98,10 +98,10 @@ public class PLine implements PConstants
private float db;
private float da;
private PGraphics3D parent;
private PGraphics parent;
public PLine(PGraphics3D g) {
public PLine(PGraphics g) {
INTERPOLATE_Z = false;
x_array = new float[2];
+6
View File
@@ -38,6 +38,12 @@ o right now the camera doesn't get set up unless you call depth()
o box and sphere are broken in gl
o what should the update image function be called?
things before 1.0
_ know internal vs. external lines, so that anti-aliasing can be shut off for internal
_ is the texture[] array in PGraphics3D causing the problems with memory?
_ for a PGraphics2D, should its image cache object be the memoryimagesource?
_ only call defaults() when it's part of a PApplet canvas