Exemple #1
0
/** ------------------------------------------------------------------------ **
 * \internal                                                                  *
 * \brief Get a Scale and Translate Transform                                 *
 *                                                                            *
 * \param pDecISF structure used to decode the ISF file.                      *
 *                                                                            *
 * \returns the error code given while processing                             *
 ** ------------------------------------------------------------------------ **/
int getTransformScaleAndTranslate (decodeISF_t * pDecISF)
{
    int err = OK;
    transform_t * pTransform;

    /**
     * This tag consists of four values describing a scale and translate
     * transform matrix.\n
     * Those four values are coded in the stream as floats (IEEE 754)\n
     * We have in order:
     * - m11
     * - m22
     * - m13
     * - m23
     *
     * The transform matrix is :\n
     * \f[
     *	\mbox{T} = \left( \begin{array}{ccc} \mbox{m}_{11} & 0 & \mbox{m}_{13} \\ 0 & \mbox{m}_{22} & \mbox{m}_{23} \\ 0 & 0 & 1\\ \end{array} \right)
     * \f]
     *
     * \see #transform_t
     */

    /* Check whether we should add a transform or use the default one */
    if (pDecISF->lastTransform != &(pDecISF->transforms) )
    {
        err = createTransform(&pTransform);
        if (err != OK)
            return err;
    } else {
        pTransform = *(pDecISF->lastTransform);
    }

    /* Fill the transform matrix */
    err = readFloat (pDecISF, &pTransform->m11);
    if (err != OK) return err;
    err = readFloat (pDecISF, &pTransform->m22);
    if (err != OK) return err;
    err = readFloat (pDecISF, &pTransform->m13);
    if (err != OK) return err;
    err = readFloat (pDecISF, &pTransform->m23);
    if (err != OK) return err;

    LOG(stdout,"(TRANSFORM_SCALE_AND_TRANSLATE) m11 = %f\n", pTransform->m11);
    LOG(stdout,"(TRANSFORM_SCALE_AND_TRANSLATE) m22 = %f\n", pTransform->m22);
    LOG(stdout,"(TRANSFORM_SCALE_AND_TRANSLATE) m13 = %f\n", pTransform->m13);
    LOG(stdout,"(TRANSFORM_SCALE_AND_TRANSLATE) m23 = %f\n", pTransform->m23);

    /* Insert the current Transform */
    *(pDecISF->lastTransform) = pTransform;
    pDecISF->lastTransform = &(pTransform->next);

    return err;
}
Exemple #2
0
/** ------------------------------------------------------------------------ **
 * \internal                                                                  *
 * \brief Get a Rotate Transform                                              *
 *                                                                            *
 * \param pDecISF structure used to decode the ISF file.                      *
 *                                                                            *
 * \returns the error code given while processing                             *
 ** ------------------------------------------------------------------------ **/
int getTransformRotate (decodeISF_t * pDecISF)
{
    int err = OK;
    INT64 rotate;
    double angle;
    transform_t * pTransform;

    /**
     * This tag consists of one MBUINT describing a rotate transform matrix.\n
     * Let's call this value "A".
     *
     * If A = 0, then there's no transformation to do; \n
     * elsewise A is one hundredth of a degree.
     *
     * The transform matrix is (with cos and sin working with radians) :\n
     * \f[
     *	\mbox{T} = \left( \begin{array}{ccc} \cos{\frac{\mbox{A} * 2 \pi}{36000}} & -\cos{\frac{\mbox{A} * 2 \pi}{36000}} & 0 \\
     *										 \sin{\frac{\mbox{A} * 2 \pi}{36000}} &  \cos{\frac{\mbox{A} * 2 \pi}{36000}} & 0 \\
     *										              0                       &              0                        & 1 \\
     *										\end{array} \right)
     * \f]
     *
     * \see #transform_t
     */

    /* Check whether we should add a transform or use the default one */
    if (pDecISF->lastTransform != &(pDecISF->transforms) )
    {
        err = createTransform(&pTransform);
        if (err != OK)
            return err;
    } else {
        pTransform = *(pDecISF->lastTransform);
    }

    err = readMBUINT(pDecISF, &rotate);
    if (err == OK && rotate)
    {
        angle = (double) rotate * RADIANPER100THOFDEGREE;
        LOG(stdout,"(TRANSFORM_ROTATE) Rotate = %lld = %lf\n",rotate,angle);

        pTransform->m11 = pTransform->m22 = (float) cos(angle);
        pTransform->m12 = - pTransform->m11;
        pTransform->m21 = (float) sin(angle);

        /* Insert the current Transform */
        *(pDecISF->lastTransform) = pTransform;
        pDecISF->lastTransform = &(pTransform->next);

    }
    return err;
}
Exemple #3
0
/** ------------------------------------------------------------------------ **
 * \internal                                                                  *
 * \brief Get a Translate Transform                                           *
 *                                                                            *
 * \param pDecISF structure used to decode the ISF file.                      *
 *                                                                            *
 * \returns the error code given while processing                             *
 ** ------------------------------------------------------------------------ **/
int getTransformTranslate (decodeISF_t * pDecISF)
{
    int err = OK;
    transform_t * pTransform;

    /**
     * This tag consists of 2 values describing a translate transform matrix.\n
     * Those two values are coded in the stream as floats (IEEE 754)\n
     * We have in order:
     * - dx
     * - dy
     *
     * The transform matrix is :\n
     * \f[
     *	\mbox{T} = \left( \begin{array}{ccc} 0 & 0 & \mbox{dx} \\ 0 & 0 & \mbox{dy} \\ 0 & 0 & 1\\ \end{array} \right)
     * \f]
     *
     * In fact the transform matrix shouldn't be like that cause that
     * transformation don't translate.\n
     * Anyway, it seems to work this way with the .Net 3.0 framework ...
     * The transform matrix should be :\n
     * \f[
     *	\mbox{T} = \left( \begin{array}{ccc} \mbox{1} & 0 & \mbox{dx} \\ 0 & \mbox{1} & \mbox{dy} \\ 0 & 0 & 1\\ \end{array} \right)
     * \f]
     */

    /* Check whether we should add a transform or use the default one */
    if (pDecISF->lastTransform != &(pDecISF->transforms) )
    {
        err = createTransform(&pTransform);
        if (err != OK)
            return err;
    } else {
        pTransform = *(pDecISF->lastTransform);
    }

    err = readFloat (pDecISF, &pTransform->m13);
    if (err != OK) return err;
    err = readFloat (pDecISF, &pTransform->m23);
    if (err != OK) return err;

    LOG(stdout,"(TRANSFORM_TRANSLATE) m13 = %f\n", pTransform->m13);
    LOG(stdout,"(TRANSFORM_TRANSLATE) m23 = %f\n", pTransform->m23);

    /* Insert the current Transform */
    *(pDecISF->lastTransform) = pTransform;
    pDecISF->lastTransform = &(pTransform->next);

    return err;
}
Exemple #4
0
void unlinkView(pScene sc1) {
  pScene  sc2;

  if ( sc1->master == -1 )  return;

  /* copy master view */
  sc2 = cv.scene[sc1->master];
  sc1->view = (pTransform)createTransform();
  memcpy(sc1->view,sc2->view,sizeof(struct transform));

  /* remove link */
  sc1->master = -1;
  sc2->slave  = -1;
}
void QgsTransformEffect::draw( QgsRenderContext &context )
{
  if ( !source() || !enabled() || !context.painter() )
    return;

  QPainter* painter = context.painter();

  //apply transformations
  painter->save();

  QTransform t = createTransform( context );
  painter->setTransform( t, true );
  drawSource( *painter );

  painter->restore();
}
Exemple #6
0
/** ------------------------------------------------------------------------ **
 * \internal                                                                  *
 * \brief Get an Anisotropic Scale Transform                                  *
 *                                                                            *
 * \param pDecISF structure used to decode the ISF file.                      *
 *                                                                            *
 * \returns the error code given while processing                             *
 ** ------------------------------------------------------------------------ **/
int getTransformAnisotropicScale (decodeISF_t * pDecISF)
{
    int err = OK;
    transform_t * pTransform;

    /**
     * This tag consists of 2 values describing an anisotropic scale transform
     * matrix.\n
     * Those two values are coded in the stream as floats (IEEE 754)\n
     * We have in order:
     * - A
     * - B
     *
     * The transform matrix is :\n
     * \f[
     *	\mbox{T} = \left( \begin{array}{ccc} \mbox{A} & 0 & 0 \\ 0 & \mbox{B} & 0 \\ 0 & 0 & 1\\ \end{array} \right)
     * \f]
     */

    /* Check whether we should add a transform or use the default one */
    if (pDecISF->lastTransform != &(pDecISF->transforms) )
    {
        err = createTransform(&pTransform);
        if (err != OK)
            return err;
    } else {
        pTransform = *(pDecISF->lastTransform);
    }

    err = readFloat (pDecISF, &pTransform->m11);
    if (err != OK) return err;
    err = readFloat (pDecISF, &pTransform->m22);
    if (err != OK) return err;

    LOG(stdout,"(TRANSFORM_ANISOTROPIC_SCALE) m11 = %f\n", pTransform->m11);
    LOG(stdout,"(TRANSFORM_ANISOTROPIC_SCALE) m22 = %f\n", pTransform->m22);

    /* Insert the current Transform */
    *(pDecISF->lastTransform) = pTransform;
    pDecISF->lastTransform = &(pTransform->next);

    return err;
}
Exemple #7
0
bool ScColorSpaceData::convert(ScColorSpaceData& data, eRenderIntent renderIntent, long transformFlags, 
	                     void* dataIn, void* dataOut, uint numElems, ScColorTransform* lastTrans)
{
	ScColorTransform transform;
	if (lastTrans)
		transform = *lastTrans;
	if (!transform)
		transform = createTransform(data, renderIntent, transformFlags);	

	bool success = false;
	if (transform)
	{
		success = transform.apply(dataIn, dataOut, numElems);
		if (!this->hasAlphaChannel() && data.hasAlphaChannel())
			data.flattenAlpha(dataOut, numElems);
		success = true;
	}
	return success;
}
Exemple #8
0
/** ------------------------------------------------------------------------ **
 * \internal                                                                  *
 * \brief Get an Isotropic Scale Transform                                    *
 *                                                                            *
 * \param pDecISF structure used to decode the ISF file.                      *
 *                                                                            *
 * \returns the error code given while processing                             *
 ** ------------------------------------------------------------------------ **/
int getTransformIsotropicScale (decodeISF_t * pDecISF)
{
    int err = OK;
    float a;
    transform_t * pTransform;

    /**
     * This tag consists of the one value describing an isotropic scale
     * transform matrix.\n
     * This value (let's call it "A") is coded in the stream as float IEEE 754\n
     * The transform matrix is :\n
     * \f[
     *	\mbox{T} = \mbox{A} * \left( \begin{array}{ccc} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1\\ \end{array} \right)
     *	= \left( \begin{array}{ccc} \mbox{A} & 0 & 0 \\ 0 & \mbox{A} & 0 \\ 0 & 0 & 1\\ \end{array} \right)
     * \f]
     * \see #transform_t
     */

    /* Check whether we should add a transform or use the default one */
    if (pDecISF->lastTransform != &(pDecISF->transforms) )
    {
        err = createTransform(&pTransform);
        if (err != OK)
            return err;
    } else {
        pTransform = *(pDecISF->lastTransform);
    }

    /*DEBUG*/
    err = readFloat (pDecISF, &a);
    if (err == OK)
    {
        LOG(stdout,"(TRANSFORM_ISOTROPIC_SCALE) a = %f\n", a);

        /* Apply the transformation to the transformation matrix */
        pTransform->m11 = pTransform-> m22 = a;

        /* Insert the current Transform */
        *(pDecISF->lastTransform) = pTransform;
        pDecISF->lastTransform = &(pTransform->next);
    }
    return err;
}
Exemple #9
0
// Convert sfRenderStates* to sf::RenderStates
inline sf::RenderStates createRenderStates(DInt colorSrcFactor, DInt colorDstFactor, DInt colorEquation,
		DInt alphaSrcFactor, DInt alphaDstFactor, DInt alphaEquation,
		const float* transform, const sfTexture* texture, const sfShader* shader)
{
    sf::RenderStates sfmlStates;
    sf::BlendMode blendMode;

    blendMode.colorSrcFactor = static_cast<sf::BlendMode::Factor>(colorSrcFactor);
    blendMode.colorDstFactor = static_cast<sf::BlendMode::Factor>(colorDstFactor);
    blendMode.colorEquation = static_cast<sf::BlendMode::Equation>(colorEquation);
    blendMode.alphaSrcFactor = static_cast<sf::BlendMode::Factor>(alphaSrcFactor);
    blendMode.alphaDstFactor = static_cast<sf::BlendMode::Factor>(alphaDstFactor);
    blendMode.alphaEquation = static_cast<sf::BlendMode::Equation>(alphaEquation);
    
    sfmlStates.blendMode = blendMode;
    sfmlStates.transform = createTransform(transform);
    sfmlStates.texture = texture ? texture->This : NULL;
    sfmlStates.shader = shader ? &shader->This : NULL;
    

    return sfmlStates;
}
Exemple #10
0
HTMLMarqueeElement::AnimationParameters
HTMLMarqueeElement::getAnimationParameters() {
    AnimationParameters parameters;
    Metrics metrics = getMetrics();

    double totalWidth = metrics.marqueeWidth + metrics.contentWidth;
    double totalHeight = metrics.marqueeHeight + metrics.contentHeight;

    double innerWidth = metrics.marqueeWidth - metrics.contentWidth;
    double innerHeight = metrics.marqueeHeight - metrics.contentHeight;

    switch (getBehavior()) {
    case kAlternate:
        switch (getDirection()) {
        case kRight:
            parameters.transformBegin =
                createTransform(innerWidth >= 0 ? 0 : innerWidth);
            parameters.transformEnd =
                createTransform(innerWidth >= 0 ? innerWidth : 0);
            parameters.distance = std::abs(innerWidth);
            break;
        case kUp:
            parameters.transformBegin =
                createTransform(innerHeight >= 0 ? innerHeight : 0);
            parameters.transformEnd =
                createTransform(innerHeight >= 0 ? 0 : innerHeight);
            parameters.distance = std::abs(innerHeight);
            break;
        case kDown:
            parameters.transformBegin =
                createTransform(innerHeight >= 0 ? 0 : innerHeight);
            parameters.transformEnd =
                createTransform(innerHeight >= 0 ? innerHeight : 0);
            parameters.distance = std::abs(innerHeight);
            break;
        case kLeft:
        default:
            parameters.transformBegin =
                createTransform(innerWidth >= 0 ? innerWidth : 0);
            parameters.transformEnd =
                createTransform(innerWidth >= 0 ? 0 : innerWidth);
            parameters.distance = std::abs(innerWidth);
        }

        if (m_loopCount % 2)
            std::swap(parameters.transformBegin, parameters.transformEnd);
        break;
    case kSlide:
        switch (getDirection()) {
        case kRight:
            parameters.transformBegin = createTransform(-metrics.contentWidth);
            parameters.transformEnd = createTransform(innerWidth);
            parameters.distance = metrics.marqueeWidth;
            break;
        case kUp:
            parameters.transformBegin = createTransform(metrics.marqueeHeight);
            parameters.transformEnd = "translateY(0)";
            parameters.distance = metrics.marqueeHeight;
            break;
        case kDown:
            parameters.transformBegin = createTransform(-metrics.contentHeight);
            parameters.transformEnd = createTransform(innerHeight);
            parameters.distance = metrics.marqueeHeight;
            break;
        case kLeft:
        default:
            parameters.transformBegin = createTransform(metrics.marqueeWidth);
            parameters.transformEnd = "translateX(0)";
            parameters.distance = metrics.marqueeWidth;
        }
        break;
    case kScroll:
    default:
        switch (getDirection()) {
        case kRight:
            parameters.transformBegin = createTransform(-metrics.contentWidth);
            parameters.transformEnd = createTransform(metrics.marqueeWidth);
            parameters.distance = totalWidth;
            break;
        case kUp:
            parameters.transformBegin = createTransform(metrics.marqueeHeight);
            parameters.transformEnd = createTransform(-metrics.contentHeight);
            parameters.distance = totalHeight;
            break;
        case kDown:
            parameters.transformBegin = createTransform(-metrics.contentHeight);
            parameters.transformEnd = createTransform(metrics.marqueeHeight);
            parameters.distance = totalHeight;
            break;
        case kLeft:
        default:
            parameters.transformBegin = createTransform(metrics.marqueeWidth);
            parameters.transformEnd = createTransform(-metrics.contentWidth);
            parameters.distance = totalWidth;
        }
        break;
    }

    return parameters;
}
Exemple #11
0
/** ------------------------------------------------------------------------ **
 * \brief Get an ISF structure from a stream                                  *
 *                                                                            *
 * \param pISF        where we construct the ISF structure                    *
 * \param streamInfo data structure where informations about the stream are   *
 *                   stored                                                   *
 * \param pGetUChar  function used to get an unsigned char from a stream.     *
 *                                                                            *
 * \returns the error code given while processing                             *
 ** ------------------------------------------------------------------------ **/
int getISF (
        ISF_t ** pISF,
        void * streamInfo,
        int (*pGetUChar) (void *, INT64 *, unsigned char*))
{
    int err = OK; /* the error code */
    INT64 tag; /* number of the current tag */
    decodeISF_t * pDecISF;

    /* we init the ISF structure */
    *pISF = (ISF_t *) malloc (sizeof(ISF_t));
    if (!*pISF)
        return OUT_OF_MEMORY;

    pDecISF = (decodeISF_t *) malloc(sizeof(decodeISF_t));
    if (!pDecISF)
    {
        free(*pISF);
        pISF = NULL;
        return OUT_OF_MEMORY;
    }
    pDecISF->streamInfo = streamInfo;
    pDecISF->getUChar = pGetUChar;
    pDecISF->ISF = *pISF;
    pDecISF->lastStroke = pDecISF->lastHighlighterStroke = &((*pISF)->strokes);
    (*pISF)->strokes = NULL;
    pDecISF->gotStylusPressure = 0;

    /* Add default Transform */
    err = createTransform(&pDecISF->transforms);
    if (err != OK)
        return err;
    pDecISF->curTransform = pDecISF->transforms;
    pDecISF->lastTransform = &pDecISF->transforms;

    /* Add default drawing attributes */
    err = createDrawingAttrs(&(*pISF)->drawAttrs);
    if (err != OK)
        return err;
    pDecISF->curDrawAttrs = (*pISF)->drawAttrs;
    pDecISF->lastDrawAttrs = &(*pISF)->drawAttrs;

    (*pISF)->width = (*pISF)->height = 0;
    (*pISF)->xOrigin = (*pISF)->yOrigin = INT64_MAX;
    (*pISF)->xEnd = (*pISF)->yEnd = INT64_MIN;
    (*pISF)->penWidthMax = (*pISF)->penHeightMax = 0;



    /* Checking the header of that file */
    err = checkHeader (pDecISF);

    while ( err == OK && pDecISF->bytesRead < pDecISF->fileSize )
    {
        err = readMBUINT(pDecISF, &tag);
        switch (tag)
        {
            case INK_SPACE_RECT:
                LOG(stderr,"\nINK_SPACE_RECT\n");
                /* TODO: nothing ?? */
                break;

            case GUID_TABLE:
                LOG(stdout,"\nGUID_TABLE\n");
                err =  getGUIDTable (pDecISF);
                break;

            case DRAW_ATTRS_TABLE:
                LOG(stdout,"\nDRAW_ATTRS_TABLE\n");
                err = getDrawAttrsTable (pDecISF);
                break;

            case DRAW_ATTRS_BLOCK:
                LOG(stdout,"\nDRAW_ATTRS_BLOCK\n");
                err = getDrawAttrsBlock (pDecISF);
                break;

            case STROKE_DESC_TABLE:
                LOG(stderr,"\nSTROKE_DESC_TABLE\n");
                /* TODO */
                break;

            case STROKE_DESC_BLOCK:
                LOG(stdout,"\nSTROKE_DESC_BLOCK\n");
                err = getStrokeDescBlock (pDecISF);
                break;

            case BUTTONS:
                LOG(stderr,"\nBUTTONS\n");
                /* TODO */
                break;

            case NO_X:
                LOG(stderr,"\nNO_X\n");
                /* TODO */
                break;

            case NO_Y:
                LOG(stderr,"\nNO_Y\n");
                /* TODO */
                break;

            case DIDX:
                LOG(stdout,"\nDIDX\n");
                err = getDIDX (pDecISF);
                break;

            case STROKE:
                LOG(stdout,"\nSTROKE\n");
                err = getStroke (pDecISF);
                break;

            case STROKE_PROPERTY_LIST:
                LOG(stderr,"\nSTROKE_PROPERTY_LIST\n");
                /* TODO */
                break;

            case POINT_PROPERTY:
                LOG(stderr,"\nPOINT_PROPERTY\n");
                /* TODO */
                break;

            case SIDX:
                LOG(stderr,"\nSIDX\n");
                /* TODO */
                break;

            case COMPRESSION_HEADER:
                LOG(stderr,"\nCOMPRESSION_HEADER\n");
                /* TODO */
                break;

            case TRANSFORM_TABLE:
                LOG(stdout,"\nTRANSFORM_TABLE\n");
                err = getTransformTable (pDecISF);
                break;

            case TRANSFORM:
                LOG(stdout,"\nTRANSFORM\n");
                err = getTransform (pDecISF);
                break;

            case TRANSFORM_ISOTROPIC_SCALE:
                LOG(stdout,"\nTRANSFORM_ISOTROPIC_SCALE\n");
                err = getTransformIsotropicScale (pDecISF);
                break;

            case TRANSFORM_ANISOTROPIC_SCALE:
                LOG(stdout,"\nTRANSFORM_ANISOTROPIC_SCALE\n");
                err = getTransformAnisotropicScale (pDecISF);
                break;

            case TRANSFORM_ROTATE:
                LOG(stdout,"\nTRANSFORM_ROTATE\n");
                err = getTransformRotate (pDecISF);
                break;

            case TRANSFORM_TRANSLATE:
                LOG(stdout,"\nTRANSFORM_TRANSLATE\n");
                err = getTransformTranslate (pDecISF);
                break;

            case TRANSFORM_SCALE_AND_TRANSLATE:
                LOG(stdout,"\nTRANSFORM_SCALE_AND_TRANSLATE\n");
                err = getTransformScaleAndTranslate (pDecISF);
                break;

            case TRANSFORM_QUAD:
                LOG(stderr,"\nTRANSFORM_QUAD\n");
                /* TODO */
                break;

            case TIDX:
                LOG(stdout,"\nTIDX\n");
                err = getTIDX (pDecISF);
                break;

            case METRIC_TABLE:
                LOG(stderr,"\nMETRIC_TABLE\n");
                /* TODO */
                break;

            case METRIC_BLOCK:
                LOG(stdout,"\nMETRIC_BLOCK\n");
                err = getMetricBlock (pDecISF);
                break;

            case MIDX:
                LOG(stderr,"\nMIDX\n");
                /* TODO */
                break;

            case MANTISSA:
                LOG(stderr,"\nMANTISSA\n");
                /* TODO */
                break;

            case PERSISTENT_FORMAT:
                LOG(stdout,"\nPERSISTENT_FORMAT\n");
                err = getPersistentFormat (pDecISF);
                break;

            case HIMETRIC_SIZE:
                LOG(stdout,"\nHIMETRIC_SIZE\n");
                err = getHimetricSize (pDecISF);
                break;

            case STROKE_IDS:
                LOG(stdout,"\nSTROKE_IDS\n");
                err = getStrokeIds (pDecISF);
                break;

            case 31:
                LOG(stdout,"\nTAG_31\n");
                err = getUnknownTag (pDecISF);
                break;

            default:
                if (tag >= 100 && tag <= pDecISF->guidIdMax)
                {
                    /* There's a GUID for that tag */
                    LOG(stdout,"\nGUID_%lld\n",tag);
                    err = getProperty (pDecISF, tag);
                } else {
                    LOG(stderr,"/!\\[MAIN] Oops, wrong flag found: %lld\n", tag);
                }
        }
    }
    /* pDecISF is no longer needed : decoding is finished */
    freeDecodeISF(pDecISF);

    return err;
}
Exemple #12
0
/* new scene */
int createScene (pScene sc, int idmesh) {
	pMesh mesh;
	char data[128];

	/* default */
	mesh = cv.mesh[idmesh];
	if (!quiet) fprintf(stdout, "   Computing 3D scene\n");

	/* set default mode */
	sc->idmesh = idmesh;
	sc->par.xi = sc->par.yi = 10;
	if (option == SCHNAUZER) {
		sc->par.xs = schw;
		sc->par.ys = schh;
	} else {
		if (sc->par.xs == 0) sc->par.xs = 600;

		if (sc->par.ys == 0) sc->par.ys = 600;
	}

	if (!sc->mode) sc->mode = HIDDEN;

	sc->item = 0;
	sc->shrink = 1.0;
	sc->slave = sc->master = -1;
	sc->picked = 0;
	if (mesh->nvn == 0) sc->type ^= S_FLAT;

	if (mesh->ne == 0) sc->item |= S_GEOM;

	/* compute scene depth */
	sc->dmax = sc->dmin = mesh->xmax - mesh->xmin;
	sc->dmax = max(sc->dmax, mesh->ymax - mesh->ymin);
	sc->dmin = min(sc->dmin, mesh->ymax - mesh->ymin);
	if (mesh->dim == 3) {
		sc->dmax = max(sc->dmax, mesh->zmax - mesh->zmin);
		sc->dmin = min(sc->dmin, mesh->zmax - mesh->zmin);
	}

	sc->dmax = fabs(sc->dmax);
	sc->dmin = fabs(sc->dmin);
	if (!sc->par.sunp) {
		sc->par.sunpos[0] *= 2.0 * sc->dmax;
		sc->par.sunpos[1] *= 2.0 * sc->dmax;
		sc->par.sunpos[2] *= 2.0 * sc->dmax;
	}

	sc->par.sunpos[3] = 1.0;

	/* create window */
	glutInitWindowSize(sc->par.xs, sc->par.ys);
	sc->idwin = glutCreateWindow("");
	assert(sc->idwin != 0);
	if (fullscreen) {
		glutFullScreen();
		sc->par.xs = glutGet(GLUT_SCREEN_WIDTH);
		sc->par.ys = glutGet(GLUT_SCREEN_HEIGHT);
	}

	/* set window name */
	sprintf(data, "Medit - [%s] #%d", mesh->name, sc->idwin);
	glutSetWindowTitle(data);
	glutSetIconTitle(data);

	/* required! to change background color */
	glClearColor(sc->par.back[0], sc->par.back[1],
	             sc->par.back[2], sc->par.back[3]);

	/* init perspective */
	sc->persp = initPersp(0, sc->dmax);
	sc->camera = (pCamera)initCamera(sc, Y_AXIS);
	if (mesh->typ == 2) {
		sc->persp->pmode = CAMERA;
		sc->persp->depth *= 0.5;
	}

	/* create default view */
	sc->view = (pTransform)createTransform();
	if (!sc->view) return (0);

	sc->type |= S_RESET + S_DECO;
	sc->clip = (pClip)createClip(sc, mesh);
	if (!sc->clip) return (0);

	sc->cube = (pCube)createCube(sc, mesh);
	if (!sc->cube) return (0);

	/* create menus */
	if (!createMenus(sc, mesh)) return (0);

	/* assign callbacks */
	if (sc->type & S_SCISSOR) {
		glutDisplayFunc(scissorScene);
	} else if (option == SCHNAUZER) {
		glutDisplayFunc(redrawSchnauzer);
	} else if (sc->persp->pmode == CAMERA) {
		glutMouseFunc(mouseCamera);
		glutMotionFunc(motionCamera);
		glutDisplayFunc(redrawScene);
	} else {
		glutMouseFunc(mouse);
		glutMotionFunc(motion);
		glutDisplayFunc(redrawScene);
	}

	glutReshapeFunc(reshapeScene);
	glutKeyboardFunc(keyScene);
	glutSpecialFunc(special);
	glutAttachMenu(GLUT_RIGHT_BUTTON);

	/* create display lists by geom type */
	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	doLists(sc, mesh);
	sc->glist = geomList(sc, mesh);
	sc->type |= S_FOLLOW;

	/* local stack */
	if (!pilmat) {
		pilmat = (int *)calloc(sc->par.nbmat + 2, sizeof(int));
		if (!pilmat) return (0);
	}

	/* color list */
	setupPalette(sc, mesh);
	sc->stream = NULL;

	initGrafix(sc, mesh);
	return (1);
}
Exemple #13
0
void sfTransform_scale(float* transform, float scaleX, float scaleY)
{
    createTransform(createTransform(transform).scale(scaleX, scaleY),transform);
}
Exemple #14
0
QRectF QgsTransformEffect::boundingRect( const QRectF &rect, const QgsRenderContext& context ) const
{
  QTransform t = createTransform( context );
  return t.mapRect( rect );
}
Exemple #15
0
void sfShader_setTransformParameter(sfShader* shader, const char* name, size_t length, float* transform)
{
    shader->This.setParameter(std::string(name, length), createTransform(transform));
}
Exemple #16
0
void sfTransform_scaleWithCenter(float* transform, float scaleX, float scaleY, float centerX, float centerY)
{
    createTransform(createTransform(transform).scale(scaleX, scaleY, centerX, centerY),transform);
}
Exemple #17
0
void sfTransform_getMatrix(const float* transform, float* matrix)
{
    sf::Transform createed = createTransform(transform);
    if (matrix)
        std::memcpy(matrix, createed.getMatrix(), 16 * sizeof(float));
}
Exemple #18
0
void sfTransform_getInverse(const float* transform, float* inverse)
{
    createTransform(createTransform(transform).getInverse(), inverse);


}
Exemple #19
0
void sfTransform_rotateWithCenter(float* transform, float angle, float centerX, float centerY)
{
    createTransform(createTransform(transform).rotate(angle, centerX, centerY),transform);
}
Exemple #20
0
void sfTransform_rotate(float* transform, float angle)
{
    createTransform(createTransform(transform).rotate(angle),transform);
}
Exemple #21
0
void sfTransform_translate(float* transform, float x, float y)
{
    createTransform(createTransform(transform).translate(x, y), transform);
}
Exemple #22
0
void sfTransform_combine(float* transform, const float* other)
{
    createTransform(createTransform(transform).combine(createTransform(other)),transform);
}