/* Copyright 1996 Acorn Computers Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /************************************************************************/ /* © Acorn Computers Ltd, 1992. */ /* */ /* This file forms part of an unsupported source release of RISC_OSLib. */ /* */ /* It may be freely used to create executable images for saleable */ /* products but cannot be sold in source form or as an object library */ /* without the prior written consent of Acorn Computers Ltd. */ /* */ /* If this file is re-distributed (even if modified) it should retain */ /* this copyright notice. */ /* */ /************************************************************************/ /* * Title: drawmod.c * Purpose: C interface to the draw module * History: IDJ: 06-Feb-92: prepared for source release * */ #include "drawmod.h" #include "os.h" /* ----------------------- DrawMod SWIs ----------------------- */ #define Draw_ProcessPath 0x00040700 #define Draw_Fill 0x00040702 #define Draw_Stroke 0x00040704 #define Draw_StrokePath 0x00040706 #define Draw_FlattenPath 0x00040708 #define Draw_TransformPath 0x0004070a #pragma -s1 os_error *drawmod_fill(drawmod_pathelemptr path_seq, drawmod_filltype fill_style, drawmod_transmat *matrix, int flatness) { os_regset r; os_error *e; r.r[0] = (int)path_seq.wordp; r.r[1] = (int)fill_style; r.r[2] = (int)matrix; r.r[3] = flatness; e = os_swix(Draw_Fill, &r); return(e); } os_error *drawmod_stroke(drawmod_pathelemptr path_seq, drawmod_filltype fill_style, drawmod_transmat *matrix, drawmod_line *line_style) { os_regset r; os_error *e; r.r[0] = (int)path_seq.wordp; r.r[1] = (int)fill_style; r.r[2] = (int)matrix; r.r[3] = line_style->flatness; r.r[4] = line_style->thickness; r.r[5] = (int)&(line_style->spec); r.r[6] = (int)(line_style->dash_pattern); e = os_swix(Draw_Stroke, &r); return(e); } #ifndef UROM os_error *drawmod_do_strokepath(drawmod_pathelemptr path_seq, drawmod_transmat *matrix, drawmod_line *line_style, drawmod_buffer *buffer) { os_regset r; os_error *e; r.r[0] = (int)path_seq.wordp; r.r[1] = (int)buffer; r.r[2] = (int)matrix; r.r[3] = line_style->flatness; r.r[4] = line_style->thickness; r.r[5] = (int)&(line_style->spec); r.r[6] = (int)(line_style->dash_pattern); e = os_swix(Draw_StrokePath, &r); return(e); } #endif #ifndef UROM os_error *drawmod_ask_strokepath(drawmod_pathelemptr path_seq, drawmod_transmat *matrix, drawmod_line *line_style, int *buflen) { os_regset r; os_error *e; r.r[0] = (int)path_seq.wordp; r.r[1] = 0; r.r[2] = (int)matrix; r.r[3] = line_style->flatness; r.r[4] = line_style->thickness; r.r[5] = (int)&(line_style->spec); r.r[6] = (int)(line_style->dash_pattern); e = os_swix(Draw_StrokePath, &r); if (e == 0) *buflen = r.r[0]; return (e); } #endif #ifndef UROM os_error *drawmod_do_flattenpath(drawmod_pathelemptr path_seq, drawmod_buffer *buffer, int flatness) { os_regset r; os_error *e; r.r[0] = (int)path_seq.wordp; r.r[1] = (int)buffer; r.r[2] = flatness; e = os_swix(Draw_FlattenPath, &r); return(e); } #endif #ifndef UROM os_error *drawmod_ask_flattenpath(drawmod_pathelemptr path_seq, int flatness, int *buflen) { os_regset r; os_error *e; r.r[0] = (int)path_seq.wordp; r.r[1] = 0; r.r[2] = flatness; e = os_swix(Draw_FlattenPath, &r); if (e == 0) *buflen = r.r[0]; return(e); } #endif #ifndef UROM os_error *drawmod_buf_transformpath(drawmod_pathelemptr path_seq, drawmod_buffer *buffer, drawmod_transmat *matrix) { os_regset r; os_error *e; r.r[0] = (int)path_seq.wordp; r.r[1] = (int)buffer; r.r[2] = (int)matrix; r.r[3] = 0; /* only fixed point - floating point not available */ e = os_swix(Draw_TransformPath, &r); return(e); } #endif #ifndef UROM os_error *drawmod_insitu_transformpath(drawmod_pathelemptr path_seq, drawmod_transmat *matrix) { os_regset r; os_error *e; r.r[0] = (int)path_seq.wordp; r.r[1] = 0; r.r[2] = (int)matrix; r.r[3] = 0; e = os_swix(Draw_TransformPath, &r); return(e); } #endif os_error *drawmod_processpath(drawmod_pathelemptr path_seq, drawmod_filltype fill_style, drawmod_transmat *matrix, drawmod_line *line_style, drawmod_options *options, int *buflen) { os_regset r; os_error *e; r.r[0] = (int)path_seq.wordp; r.r[1] = (int)fill_style; r.r[2] = (int)matrix; r.r[3] = line_style->flatness; r.r[4] = line_style->thickness; r.r[5] = (int)&(line_style->spec); r.r[6] = (int)(line_style->dash_pattern); switch (options->tag) { case tag_fill: r.r[7] = (int)(options->data.opts); break; case tag_box: r.r[7] = (int)(options->data.box) | 0x80000000; break; case tag_buf: r.r[7] = (int)(options->data.buffer); break; default: r.r[7] = 0; /* probably force a fail */ break; } e = os_swix(Draw_ProcessPath, &r); if (e==0) switch (options->tag) { case tag_fill: if (options->data.opts == option_countsize) if(buflen !=0) *buflen = r.r[0]; break; case tag_box: break; case tag_buf: break; } return(e); } #pragma -s0 /* end drawmod.c */