/* Initialization of the object, called by the ctors */ void init(int32 L,int32 V) { if ((N<2)||(N>4191)) {MTOOLS_ERROR("BitGraphZ2::Init(), template parameter N has incorrect value !"); } if ((V<2)||(V>2000000000)) {MTOOLS_ERROR("BitGraphZ2::Init(), constructor parameter L or V is incorrect !"); } if ((L<2)||(L>1000000)) {MTOOLS_ERROR("BitGraphZ2::Init(), parameter L incorrect !");} VV = V; LL = (int64)L; Grid = new int32[(size_t)(4*LL*LL)]; MStab = new _MSQ[(size_t)(VV)]; clear(); }
void blit(Image & im, float op = 1.0f, bool reverse = true, int blitType = BLIT_CLASSIC) { switch (blitType) { case BLIT_CLASSIC: { blit_classic(im, op, reverse); return; } case BLIT_REMOVE_TRANSPARENT_WHITE: { blit_removeWhite(im, op, reverse); return; } case BLIT_REMOVE_TRANSPARENT_BLACK: { blit_removeBlack(im, op, reverse); return; } } MTOOLS_ERROR("Illegal blitType argument..."); }
/* update the state of the round button and request a redraw */ void _updateImageTypeInFLTK() { if (_LD->imageType() == _LD->TYPEIMAGE) { _checkButtonImage->setonly(); } else { _checkButtonColor->setonly(); } _opacifySlider->value(_LD->opacify()); int rem = _LD->transparentColor(); switch (rem) { case REMOVE_WHITE: { _checkWhite->value(1); _checkBlack->value(0); break; } case REMOVE_BLACK: { _checkWhite->value(0); _checkBlack->value(1); break; } case REMOVE_NOTHING: { _checkWhite->value(0); _checkBlack->value(0); break; } default: MTOOLS_ERROR("wtf..."); } refresh(); }
/** * Unset the point at a given coordinate. Does nothing is outside of the whole square. * * @param x The x coordinate. * @param y The y coordinate. **/ inline void unset(int64 x,int64 y) { if (x > maxx) {maxx = x;} if (y > maxy) {maxy = y;} if (x < minx) {minx = x;} if (y < miny) {miny = y;} int64 rx = (8*LL*N) + x; int64 ry = (8*LL*N) + y; if (((rx<0)||(rx >= 16*(LL*N)))||((ry<0)||(ry >= 16*(LL*N)))) {return;} size_t Gpos = (size_t)((rx/(8*N)) + ((2*LL)*(ry/(8*N)))); int32 p = Grid[Gpos]; if (p == -1) {return;} if (p == -2) {if (v == VV) {cleanup(); if (v == VV) {MTOOLS_ERROR("BitGraphZ2::Unset(), out of memory !"); }} Grid[Gpos] = v; MStab[v].reset1(Gpos); v++;} MStab[Grid[Gpos]].unset((rx%(8*N)),(ry%(8*N)),totset); }
/** * Resize the permutation. * - If the size is increased, then perm[k] = k for all new elements. * - If the size is decreased, the subset {newsize,..., size-1} must * be stable by the permutation otherwise an error is raised. **/ void resize(int newsize) { const size_t l = _perm.size(); if (newsize >= (int)l) // increase size { _perm.resize(newsize); _invperm.resize(newsize); for (size_t i = l; i < (size_t)newsize; i++) { _perm[i] = (int)i; _invperm[i] = (int)i; } return; } for (size_t i = newsize; i < l; i++) { if (_perm[i] < newsize) { MTOOLS_ERROR("Subset is not stable: perm[" << i << "]=" << _perm[i] << " < newsize = " << newsize); } } _perm.resize(newsize); _invperm.resize(newsize); }
/* to override */ Drawable2DInterface * Plotter2DObj::inserted(Fl_Group * & optionWin, int reqWidth) { MTOOLS_ERROR("Plotter2DObj::inserted must be overriden !"); return nullptr; }