Skip to content

Commit

Permalink
CPlot: fopenw
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit128 committed Jul 10, 2024
1 parent 836bc3f commit 7f1316c
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 212 deletions.
1 change: 1 addition & 0 deletions Cassiopee/CPlot/CPlot/Data.h
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ class Data
double alpha, double beta);
void sharpenImage(E_Int w, E_Int h, char* im1, char* im2, double amount,
E_Int radius, E_Int threshold);
FILE* fopenw(const char* path, const char* mode);
void exportFile();
void finalizeExport();
void dataMouseClickSelect(E_Int button, E_Int etat, E_Int x, E_Int y,
Expand Down
52 changes: 52 additions & 0 deletions Cassiopee/CPlot/CPlot/Plugins/fopenw.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
Copyright 2013-2024 Onera.
This file is part of Cassiopee.
Cassiopee 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 3 of the License, or
(at your option) any later version.
Cassiopee 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 Cassiopee. If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include "Data.h"

// fopen for write with check of dirname existence (one level only)
FILE* Data::fopenw(const char* path, const char* mode)
{
E_Int end = strlen(path);
E_Int start;
FILE* r = NULL;
for (start = end-1; start >= 0; start--)
{
if (path[start] == '/' || path[start] == '\\') break;
}
if (start > 0) // dirname exists
{
char* dirname = new char [end];
for (E_Int i = 0; i < start; i++) dirname[i] = path[i];
dirname[start] = '\0';

r = fopen(dirname, "rb");
if (r == NULL)
{
//printf("Info: CPlot: %s not found. creating.\n", dirname);
mkdir(dirname, 0755);
};
delete [] dirname;
}

r = fopen(path, mode);
return r;
}
2 changes: 1 addition & 1 deletion Cassiopee/CPlot/CPlot/Shaders2.0/ShaderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ int ShaderManager::init()
//=============================================================================
int ShaderManager::load()
{
char vert[256*8]; char frag[256*8]; char geom[256*8];
char vert[256*8]; char frag[256*8];
Data* d = Data::getInstance();
char* path = d->ptrState->shaderPath;

Expand Down
7 changes: 5 additions & 2 deletions Cassiopee/CPlot/CPlot/set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,12 @@ PyObject* K_CPLOT::changeVariable(PyObject* self, PyObject* args)
//=============================================================================
PyObject* K_CPLOT::changeStyle(PyObject* self, PyObject* args)
{
printf("coucou\n");
Data* d = Data::getInstance();
d->changeAppearance();
d->ptrState->render = 1;
d->fopenw("tata/titi/toto.png", "wb");

//d->changeAppearance();
//d->ptrState->render = 1;
return Py_BuildValue("i", KSUCCESS);
}

Expand Down
1 change: 1 addition & 0 deletions Cassiopee/CPlot/srcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
'CPlot/Plugins/colormaps.cpp',
'CPlot/Plugins/select.cpp',
'CPlot/Plugins/lookfor.cpp',
'CPlot/Plugins/fopenw.cpp',
'CPlot/Plugins/gl2ps.cpp',
'CPlot/Plugins/writePPMFile.cpp',
'CPlot/Plugins/imagePost.cpp',
Expand Down
119 changes: 0 additions & 119 deletions tools/BUNDLER/binex

This file was deleted.

90 changes: 0 additions & 90 deletions tools/BUNDLER/rmpyc

This file was deleted.

Empty file modified tools/moveDist
100644 → 100755
Empty file.

0 comments on commit 7f1316c

Please sign in to comment.