Re-apply current settings. Some methods, such as textFont(), require that their methods be called (rather than simply setting the textFont variable) because they affect the graphics context, or they require parameters from the context (e.g. getting native fonts for text). This will only be called f
()
| 1017 | * called before defaultSettings(), so we should be safe. |
| 1018 | */ |
| 1019 | protected void reapplySettings() { |
| 1020 | // This might be called by allocate... So if beginDraw() has never run, |
| 1021 | // we don't want to reapply here, we actually just need to let |
| 1022 | // defaultSettings() get called a little from inside beginDraw(). |
| 1023 | if (!settingsInited) return; // if this is the initial setup, no need to reapply |
| 1024 | |
| 1025 | colorMode(colorMode, colorModeX, colorModeY, colorModeZ); |
| 1026 | if (fill) { |
| 1027 | // PApplet.println(" fill " + PApplet.hex(fillColor)); |
| 1028 | fill(fillColor); |
| 1029 | } else { |
| 1030 | noFill(); |
| 1031 | } |
| 1032 | if (stroke) { |
| 1033 | stroke(strokeColor); |
| 1034 | |
| 1035 | // The if() statements should be handled inside the functions, |
| 1036 | // otherwise an actual reset/revert won't work properly. |
| 1037 | //if (strokeWeight != DEFAULT_STROKE_WEIGHT) { |
| 1038 | strokeWeight(strokeWeight); |
| 1039 | //} |
| 1040 | // if (strokeCap != DEFAULT_STROKE_CAP) { |
| 1041 | strokeCap(strokeCap); |
| 1042 | // } |
| 1043 | // if (strokeJoin != DEFAULT_STROKE_JOIN) { |
| 1044 | strokeJoin(strokeJoin); |
| 1045 | // } |
| 1046 | } else { |
| 1047 | noStroke(); |
| 1048 | } |
| 1049 | if (tint) { |
| 1050 | tint(tintColor); |
| 1051 | } else { |
| 1052 | noTint(); |
| 1053 | } |
| 1054 | // if (smooth) { |
| 1055 | // smooth(); |
| 1056 | // } else { |
| 1057 | // // Don't bother setting this, cuz it'll anger P3D. |
| 1058 | // noSmooth(); |
| 1059 | // } |
| 1060 | if (textFont != null) { |
| 1061 | // System.out.println(" textFont in reapply is " + textFont); |
| 1062 | // textFont() resets the leading, so save it in case it's changed |
| 1063 | float saveLeading = textLeading; |
| 1064 | textFont(textFont, textSize); |
| 1065 | textLeading(saveLeading); |
| 1066 | } |
| 1067 | textMode(textMode); |
| 1068 | textAlign(textAlign, textAlignY); |
| 1069 | background(backgroundColor); |
| 1070 | |
| 1071 | blendMode(blendMode); |
| 1072 | |
| 1073 | reapplySettings = false; |
| 1074 | } |
| 1075 | |
| 1076 | // inherit from PImage |
no test coverage detected