Files
FireBee_Setup/tools/vision/LDV/SRC/rotate/ROTATE.C
2022-11-14 10:05:42 +01:00

129 lines
3.7 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
*
*
* Version PureC / Gcc
*/
#define PCGEMLIB 1 /* mettre 1 si les utilisateurs de Pure C
* utilise les librairies GEM Pure C */
/* Fichiers headers */
#include <portab.h>
#if PCGEMLIB
#include <aes.h>
#include <vdi.h>
#else
#include <aesbind.h>
#include <vdibind.h>
#endif
#include <string.h>
#include <stdlib.h>
#include "..\..\ldg.h"
#include "..\..\vapi.h"
#include "..\..\ldv.h"
#include "..\..\mt_aes.h"
/* Prototypages */
LDV_INFOS* cdecl GetLDVCapabilities(VAPI *vapi) ;
LDV_STATUS cdecl PreRun(LDV_IMAGE *in, LDV_PARAMS *params, LDV_IMAGE *out) ;
LDV_STATUS cdecl Run(LDV_IMAGE *in, LDV_PARAMS *params, LDV_IMAGE *out) ;
LDV_STATUS cdecl Preview(LDV_IMAGE *in, LDV_PARAMS *params, LDV_IMAGE *out) ;
void OnClose(void) ;
/* Variables globales */
PROC Proc[] = {
"GetLDVCapabilities", "Capacits du LDV", (void *)GetLDVCapabilities,
"PreRun", "Init du Run", (void *)PreRun,
"Run", "Fonction du LDV", (void *)Run,
"Preview", "Pre-Visu", (void *)Preview,
} ;
char Info[] = "LDV";
LDGLIB Ldg[] = {
0x0100, /* version de la lib, recommand */
4, /* nombre de fonction dans la lib */
Proc, /* Pointeurs vers nos fonctions */
Info, /* Information sur la lib */
0x0, /* Flags de la lib, obligatoire */
NULL,
};
#define BP_CAPS (LDVF_SPECFORMAT | LDVF_SUPPORTPREVIEW | LDVF_SUPPORTPROG | LDVF_REALTIMEPARAMS | LDVF_SUPPORTCANCEL | LDVF_NOSELECTION)
#define TC_CAPS (LDVF_SPECFORMAT | LDVF_SUPPORTPREVIEW | LDVF_SUPPORTPROG | LDVF_REALTIMEPARAMS | LDVF_SUPPORTCANCEL | LDVF_NOSELECTION)
LDV_INFOS LdvInfos = {
(short) sizeof(LDV_INFOS), /* Taille de cette structure */
TLDV_MODIFYIMG, /* Type du LDV */
"Jean Lusetti", /* Auteurs */
{
{ 1, 1, BP_CAPS }, /* Capacites pour 1 plan */
{ 2, 2, BP_CAPS }, /* Capacites pour 2 plans */
{ 4, 4, BP_CAPS }, /* Capacites pour 4 plans */
{ 8, 8, BP_CAPS }, /* Capacites pour 8 plans */
{ 16, 16, TC_CAPS }, /* Capacites pour 16 plans */
{ 32, 32, TC_CAPS }, /* Capacites pour 32 plans */
{ 0, 0, 0UL } /* Fin de la liste des capacites */
},
} ;
VAPI *Vapi = NULL ;
/* Petite macro de verification pour VAPI */
#define CHECK_VAPI(vapi) if ( ( vapi == NULL ) || ( vapi->Header.Version < 0x0103 ) ) return( ELDV_BADVAPIVERSION ) ;
/*
* Fonctions de la librairie
*/
LDV_INFOS* cdecl GetLDVCapabilities(VAPI *vapi)
{
Vapi = vapi ;
return( &LdvInfos ) ;
}
#pragma warn -par
LDV_STATUS cdecl PreRun(LDV_IMAGE *in, LDV_PARAMS *params, LDV_IMAGE *out)
{
long angle ;
CHECK_VAPI( Vapi ) ;
angle = (long) params->Param[0].s ;
Vapi->RaRasterRotateGetDstMFDB( &in->Raster, &out->Raster, angle ) ;
return( ELDV_NOERROR ) ;
}
LDV_STATUS cdecl Run(LDV_IMAGE *in, LDV_PARAMS *params, LDV_IMAGE *out)
{
LDV_STATUS status ;
long angle ;
CHECK_VAPI( Vapi ) ;
angle = (long) params->Param[0].s ;
status = Vapi->RaRasterRotate( &in->Raster, &out->Raster, angle, 0x03 ) ; /* 0x03 = 0x01 (progress) | 0x02 (cancel) */
return( status ) ;
}
LDV_STATUS cdecl Preview(LDV_IMAGE *in, LDV_PARAMS *params, LDV_IMAGE *out)
{
return( Run( in, params, out ) ) ;
}
#pragma warn +par
int main(void)
{
ldg_init( Ldg ) ;
return( 0 ) ;
}