ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
slice_image.c
Go to the documentation of this file.
1/*****************************************************************************
2 * ugBASIC - an isomorphic BASIC language compiler for retrocomputers *
3 *****************************************************************************
4 * Copyright 2021-2026 Marco Spedaletti (asimov@mclink.it)
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *----------------------------------------------------------------------------
18 * Concesso in licenza secondo i termini della Licenza Apache, versione 2.0
19 * (la "Licenza"); è proibito usare questo file se non in conformità alla
20 * Licenza. Una copia della Licenza è disponibile all'indirizzo:
21 *
22 * http://www.apache.org/licenses/LICENSE-2.0
23 *
24 * Se non richiesto dalla legislazione vigente o concordato per iscritto,
25 * il software distribuito nei termini della Licenza è distribuito
26 * "COSÌ COM'È", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO, esplicite o
27 * implicite. Consultare la Licenza per il testo specifico che regola le
28 * autorizzazioni e le limitazioni previste dalla medesima.
29 ****************************************************************************/
30
31/****************************************************************************
32 * INCLUDE SECTION
33 ****************************************************************************/
34
35#include "../../ugbc.h"
36
37/****************************************************************************
38 * CODE SECTION
39 ****************************************************************************/
40
41extern char DATATYPE_AS_STRING[][16];
42
43//@tobe SLICE IMAGE
44void slice_image( Environment * _environment, char * _image, char * _frame, char * _sequence, char * _destination ) {
45
46 Variable * image = variable_retrieve( _environment, _image );
47 Variable * destination = variable_retrieve( _environment, _destination );
48 Variable * frame = NULL;
49 if ( _frame) {
50 frame = variable_retrieve_or_define( _environment, _frame, VT_BYTE, 0 );
51 }
52 Variable * sequence = NULL;
53 if ( _sequence) {
54 sequence = variable_retrieve_or_define( _environment, _sequence, VT_BYTE, 0 );
55 }
56
58 if (
59 ! _environment->sliceImageX && ! _environment->sliceImageY
60 ) {
62 } else {
64 }
65
66 switch( image->type ) {
67 case VT_SEQUENCE:
68 if ( !sequence ) {
69 if ( !frame ) {
70 tms9918_slice_image( _environment, image->realName, "", "", image->frameSize, image->frameCount, destination->realName );
71 } else {
72 tms9918_slice_image( _environment, image->realName, frame->realName, "", image->frameSize, image->frameCount, destination->realName );
73 }
74 } else {
75 if ( !frame ) {
76 tms9918_slice_image( _environment, image->realName, "", sequence->realName, image->frameSize, image->frameCount, destination->realName );
77 } else {
78 tms9918_slice_image( _environment, image->realName, frame->realName, sequence->realName, image->frameSize, image->frameCount, destination->realName );
79 }
80 }
81 break;
82 case VT_IMAGES:
83 if ( !frame ) {
84 tms9918_slice_image( _environment, image->realName, "", NULL, image->frameSize, 0, destination->realName );
85 } else {
86 tms9918_slice_image( _environment, image->realName, frame->realName, NULL, image->frameSize, 0, destination->realName );
87 }
88 break;
89 case VT_IMAGE:
90 tms9918_slice_image( _environment, image->realName, NULL, NULL, 0, 0, destination->realName );
91 break;
92 default:
94 }
95
96}
Variable * variable_retrieve(Environment *_environment, char *_name)
Variable * variable_retrieve_or_define(Environment *_environment, char *_name, VariableType _type, int _value)
void slice_image(Environment *_environment, char *_image, char *_frame, char *_sequence, char *_destination)
Definition slice_image.c:43
void(* Tms9918SliceImageFunction)(Environment *, char *, char *, char *, int, int, char *)
Definition cga.h:202
char * sliceImageX
Definition ugbc.h:3075
char * sliceImageY
Definition ugbc.h:3080
VariableType type
Definition ugbc.h:988
int frameSize
Definition ugbc.h:1134
int frameCount
Definition ugbc.h:1137
char * realName
Definition ugbc.h:982
void tms9918_slice_image_extract(Environment *_environment, char *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_destination)
Definition tms9918.c:2712
void tms9918_slice_image(Environment *_environment, char *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_destination)
Definition tms9918.c:2688
void tms9918_slice_image_copy(Environment *_environment, char *_image, char *_frame, char *_sequence, int _frame_size, int _frame_count, char *_destination)
Definition tms9918.c:2692
#define CRITICAL_SLICE_IMAGE_UNSUPPORTED(v, t)
Definition ugbc.h:3656
struct _Variable Variable
Structure of a single variable.
struct _Environment Environment
Structure of compilation environment.
@ VT_BYTE
Definition ugbc.h:450
@ VT_IMAGES
Definition ugbc.h:495
@ VT_IMAGE
Definition ugbc.h:489
@ VT_SEQUENCE
Definition ugbc.h:513
char DATATYPE_AS_STRING[][16]