Skip to content

Commit

Permalink
Removes textMode(MODEL) references to avoid problems with pdf export
Browse files Browse the repository at this point in the history
Adds a new exportToPdf example
  • Loading branch information
jagracar committed Sep 14, 2016
1 parent d388212 commit daae9a9
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<classpath>
<classpathentry kind="src" output="bin" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/home/jgracia/admin/eclipse/libs/core.jar"/>
<classpathentry kind="lib" path="/home/jgracia/admin/eclipse-libs/core.jar"/>
<classpathentry kind="output" path="resources/code"/>
</classpath>
40 changes: 40 additions & 0 deletions examples/ExportToPdf/ExportToPdf.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

import processing.pdf.*;
import grafica.*;

GPlot plot;

void setup() {
size(500, 350, PDF, "graficaPlot.pdf");
textMode(SHAPE);

// Prepare the points for the plot
int nPoints = 100;
GPointsArray points = new GPointsArray(nPoints);

for (int i = 0; i < nPoints; i++) {
points.add(i, 10*noise(0.1*i));
}

// Create a new plot and set its position on the screen
plot = new GPlot(this);
plot.setPos(25, 25);
// or all in one go
// plot = new GPlot(this, 25, 25);

// Set the plot title and the axis labels
plot.setTitleText("A very simple example");
plot.getXAxis().setAxisLabelText("x axis");
plot.getYAxis().setAxisLabelText("y axis");

// Add the points
plot.setPoints(points);
}

void draw(){
background(150);

// Draw it!
plot.defaultDraw();
exit();
}
4 changes: 2 additions & 2 deletions resources/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sketchbook.location=${user.home}/sketchbook
# For OS X,the following path will direct you into Processing's application
# package, in case you put Processing inside your Applications folder.

classpath.local.location=${user.home}/admin/eclipse/libs
classpath.local.location=${user.home}/admin/eclipse-libs
#classpath.local.location=/Applications/Processing.app/Contents/Java/core/library


Expand Down Expand Up @@ -155,7 +155,7 @@ compatible.maxRevision=0
# against. This information is only used in the generated webpage.

tested.platform=linux
tested.processingVersion=3.1.1
tested.processingVersion=3.2.1


# Additional information for the generated webpage.
Expand Down
4 changes: 0 additions & 4 deletions src/grafica/GAxis.java
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,6 @@ public void draw() {
*/
protected void drawAsXAxis() {
parent.pushStyle();
parent.textMode(MODEL);
parent.textFont(font);
parent.textSize(fontSize);
parent.fill(fontColor);
Expand Down Expand Up @@ -567,7 +566,6 @@ protected void drawAsXAxis() {
*/
protected void drawAsYAxis() {
parent.pushStyle();
parent.textMode(MODEL);
parent.textFont(font);
parent.textSize(fontSize);
parent.fill(fontColor);
Expand Down Expand Up @@ -621,7 +619,6 @@ protected void drawAsYAxis() {
*/
protected void drawAsTopAxis() {
parent.pushStyle();
parent.textMode(MODEL);
parent.textFont(font);
parent.textSize(fontSize);
parent.fill(fontColor);
Expand Down Expand Up @@ -679,7 +676,6 @@ protected void drawAsTopAxis() {
*/
protected void drawAsRightAxis() {
parent.pushStyle();
parent.textMode(MODEL);
parent.textFont(font);
parent.textSize(fontSize);
parent.fill(fontColor);
Expand Down
4 changes: 0 additions & 4 deletions src/grafica/GAxisLabel.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public void draw() {
*/
protected void drawAsXLabel() {
parent.pushStyle();
parent.textMode(MODEL);
parent.textFont(font);
parent.textSize(fontSize);
parent.fill(fontColor);
Expand All @@ -133,7 +132,6 @@ protected void drawAsXLabel() {
*/
protected void drawAsYLabel() {
parent.pushStyle();
parent.textMode(MODEL);
parent.textFont(font);
parent.textSize(fontSize);
parent.fill(fontColor);
Expand All @@ -160,7 +158,6 @@ protected void drawAsYLabel() {
*/
protected void drawAsTopLabel() {
parent.pushStyle();
parent.textMode(MODEL);
parent.textFont(font);
parent.textSize(fontSize);
parent.fill(fontColor);
Expand All @@ -187,7 +184,6 @@ protected void drawAsTopLabel() {
*/
protected void drawAsRightLabel() {
parent.pushStyle();
parent.textMode(MODEL);
parent.textFont(font);
parent.textSize(fontSize);
parent.fill(fontColor);
Expand Down
1 change: 0 additions & 1 deletion src/grafica/GHistogram.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ public void draw(GPoint plotBasePoint) {
*/
protected void drawHistLabels() {
parent.pushStyle();
parent.textMode(MODEL);
parent.textFont(font);
parent.textSize(fontSize);
parent.fill(fontColor);
Expand Down
2 changes: 0 additions & 2 deletions src/grafica/GLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,6 @@ public void drawLabel(GPoint point) {

parent.pushStyle();
parent.rectMode(CORNER);
parent.textMode(MODEL);
parent.noStroke();
parent.textFont(font);
parent.textSize(fontSize);
Expand Down Expand Up @@ -1575,7 +1574,6 @@ public void drawAnnotation(String text, float x, float y, int horAlign, int verA
}

parent.pushStyle();
parent.textMode(MODEL);
parent.textFont(font);
parent.textSize(fontSize);
parent.fill(fontColor);
Expand Down
1 change: 0 additions & 1 deletion src/grafica/GTitle.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public GTitle(PApplet parent, float[] dim) {
*/
public void draw() {
parent.pushStyle();
parent.textMode(MODEL);
parent.textFont(font);
parent.textSize(fontSize);
parent.fill(fontColor);
Expand Down

0 comments on commit daae9a9

Please sign in to comment.