/*! \brief Return information on a string. * \param [in] fontHandle Handle of font to use (0 for current handle) if * \b PlotType.GivenFont (bit 8) of flags set. * \param [in] str String to scan * \param [in] flags Plot type * \param [in] offset Offset of mouse click * \param [in,out] coordBlock Coordinate block for input if \b Font.PlotType.GivenBlock (bit 5) * of flags set and output if \b PlotType.ReturnBBox (bit 18) set, otherwise \b null. * \param [in,out] matrix Transformation matrix for input if \b PlotType.GivenMatrix (bit 6) * of flags set and output if \b PlotType.ReturnMatrix (bit 19) set, otherwise \b null. * \param [in] length Length of string to scan - if \b PlotType.GivenLength (bit 7) of flags set * \param [out] offsetReturn x,y coordinate offset to caret position - * if \b PlotType.ReturnCaretPos (bit 17) of flags set; else to split point, * or end of string if splitting not required * \param [out] splitCount Number of split characters encountered - * if \b PlotType.ReturnSplitCount (bit 20) of flags set * \return Index of point in string of caret position - if \b PlotType.ReturnCaretPos * (bit 17) of flags is set; else of split point, or of end of string if splitting * not required. */ public static int ScanString(IntPtr fontHandle, string str, PlotType flags, OS.Coord offset, Font.ScanCoordBlock coordBlock, OS.Matrix matrix, int length, OS.Coord offsetReturn, out int splitCount) { int result_index; OS.ThrowOnError(NativeMethods.Font_ScanString(fontHandle, str, flags, offset.X, offset.Y, coordBlock, matrix, length, out result_index, out offsetReturn.X, out offsetReturn.Y, out splitCount)); return(result_index); }
internal static extern IntPtr Font_Paint(IntPtr font, string s, Font.PlotType flags, int xPos, int yPos, [In] Font.PaintCoordBlock CoordBlock, [In] OS.Matrix matrix, int length);
public int f; // y translation // Construct a native transformation matrix from a managed one public Matrix(OS.Matrix matrix) { a = matrix.Cell00; b = matrix.Cell01; c = matrix.Cell10; d = matrix.Cell11; e = matrix.Cell20; f = matrix.Cell21; }
internal static extern IntPtr Font_ScanString(IntPtr font, string s, Font.PlotType flags, int x, int y, [In, Out] Font.ScanCoordBlock coordBlock, [In, Out] OS.Matrix matrix, int length, out int splitIndexOut, out int xOut, out int yOut, out int splitCountOut);
/*! \brief Call the Drawfile RISC OS module to render a draw file to screen. * \param [in] flags Additional rendering options. * \param [in] drawfile A byte array holding the draw file. * \param [in] matrix A standard RISC OS matrix, that allows the draw file to * be translated, rotated, scaled, etc. * \param [in] flatness A value defining how smooth curves should be rendered. * \return Nothing. * \note There is no x,y coordinate defining the position to render the draw * file. Instead, the matrix is used to translate the file to the correct * position. * \note The origin of the draw file (ie, point 0,0) is at its bottom left * hand corner. * \note The RISC OS call requires the size in bytes of the draw file. This is * assumed to be the length of the byte array that contains it. */ public static void Render(RenderFlags flags, byte [] drawfile, OS.Matrix matrix, int flatness) { OS.ThrowOnError(NativeMethods.Drawfile_Render(flags, drawfile, drawfile.Length, matrix, IntPtr.Zero, flatness)); }
/*! \brief Write a string to the screen. * \param[in] str String to write * \param[in] flags Plot type * \param[in] xPos Start x coordinate (Must be in millipoints) * \param[in] yPos Start y coordinate (Must be in millipoints) * \param[in] matrix Transformation matrix * \param[in] length Length of string to write (if bit 7 of flags set) * \return Nothing * * \note * Automatically: * \li Sets flag bit 6 to indicate transformation matrix is used. * \li Sets flag bit 8 to indicate font handle is used * \li Clears flag bit 5 to indicate coordinate block not in use * \li Clears flag bit 4 - must use millipoints when using matrix */ public void Paint(string str, PlotType flags, int xPos, int yPos, OS.Matrix matrix, int length) { flags |= PlotType.GivenMatrix | PlotType.GivenFont; flags &= ~(PlotType.GivenBlock | PlotType.OSUnits); Font.Paint(Handle, str, flags, xPos, yPos, null, matrix, length); }
/*! \brief Call RISC OS Drawfile module to find the coordinates of the bounding box * that encloses the draw file. * \param [in] flags Currently unused and should be 0. * \param [in] drawfile A byte array holding the draw file. * \param [in] matrix A standard RISC OS matrix, that allows the draw file to * be translated, rotated, scaled, etc before the bounding box is returned. * \return A rectangle giving the bounding box coordinates. * \note The RISC OS call requires the size in bytes of the draw file. This is * assumed to be the length of the byte array that contains it. */ public static OS.Rect GetBounds(int flags, byte [] drawfile, OS.Matrix matrix) { var bounding_box = new OS.Rect(); OS.ThrowOnError(NativeMethods.Drawfile_GetBBox(flags, drawfile, drawfile.Length, matrix, bounding_box)); return(bounding_box); }
/*! \brief Call the Drawfile RISC OS module to render a draw file to screen. * \param [in] flags Additional rendering options. * \param [in] drawfile A byte array holding the draw file. * \param [in] matrix A standard RISC OS matrix, that allows the draw file to * be translated, rotated, scaled, etc. * \param [in] clip A clipping rectangle to limit the parts of the draw file to * be rendered. Usually used in a Wimp redraw loop. Set to \b null to render all * the draw file. * \param [in] flatness A value defining how smooth curves should be rendered. * \return Nothing. * \note There is no x,y coordinate defining the position to render the draw * file. Instead, the matrix is used to translate the file to the correct * position. * \note The origin of the draw file (ie, point 0,0) is at its bottom left * hand corner. * \note The RISC OS call requires the size in bytes of the draw file. This is * assumed to be the length of the byte array that contains it. */ public static void Render(RenderFlags flags, byte [] drawfile, OS.Matrix matrix, ref NativeOS.Rect clip, int flatness) { OS.ThrowOnError(NativeMethods.Drawfile_Render(flags, drawfile, drawfile.Length, matrix, ref clip, flatness)); }
/*! \brief Write a string to the screen. * \param[in] str String to write * \param[in] flags plot type * \param[in] xPos Start x coordinate (Must be in millipoints) * \param[in] yPos Start y coordinate (Must be in millipoints) * \param[in] coordBlock Coordinate block * \param[in] matrix Transformation matrix * \param[in] length Length of string to write (if bit 7 of flags set) * \return Nothing * * \note * Automatically: * \li Sets flag bit 5 to indicate coordinate block is used * \li Sets flag bit 6 to indicate transformation matrix is used. * \li Sets flag bit 8 to indicate font handle is used * \li Clears flag bit 0 because coordinate block is used * \li Clears flag bit 4 - coordinates must be in millipoints when * coordinate block and/or matrix is used */ public void Paint(string str, PlotType flags, int xPos, int yPos, Font.PaintCoordBlock coordBlock, OS.Matrix matrix, int length) { flags |= PlotType.GivenBlock | PlotType.GivenMatrix | PlotType.GivenFont; flags &= ~(PlotType.OSUnits | PlotType.Justify); Font.Paint(Handle, str, flags, xPos, yPos, coordBlock, matrix, length); }
/*! \brief Write a string to the screen. * \param [in] fontHandle Handle of font to use (0 for current handle) if * \b PlotType.GivenFont (bit 8) of flags set. * \param [in] str String to write. * \param [in] flags Plot type. * \param [in] xPos Start x coordinate. * \param [in] yPos Start y coordinate. * \param [in] coordBlock Coordinate block if \b Font.PlotType.GivenBlock (bit 5) of * flags set, otherwise \b null. * \param [in] matrix Transformation matrix if \b PlotType.GivenMatrix (bit 6) of * flags set, otherwise \b null. * \param [in] length Length of string to write if \b PlotType.GivenLength (bit 7) of flags set. * \return Nothing. */ public static void Paint(IntPtr fontHandle, string str, PlotType flags, int xPos, int yPos, Font.PaintCoordBlock coordBlock, OS.Matrix matrix, int length) { OS.ThrowOnError(NativeMethods.Font_Paint(fontHandle, str, flags, xPos, yPos, coordBlock, matrix, length)); }
/*! \brief Return information on a string. * \param[in] str String to scan * \param[in] flags Plot type * \param[in] offset Offset of mouse click * \param[in,out] matrix Transformation matrix * \param[in] length Length of string to scan - if \b PlotType.GivenLength (bit 7) of flags set * \param[out] offsetReturn x,y coordinate offset to caret position - * if \b PlotType.ReturnCaretPos (bit 17) of flags set; else to split point, * or end of string if splitting not required * \param[out] splitCount Number of split characters encountered - * if \b PlotType.ReturnSplitCount (bit 20) of flags set * \return Index of point in string of caret position - if \b PlotType.ReturnCaretPos * (bit 17) of flags is set; else of split point, or of end of string if splitting * not required. * * \note * Automatically: * \li Sets flag bit 6 to indicate transformation matrix in use * \li Sets flag bit 8 to indicate font handle in use * \li Clears flag bits 5 & 18 to indicate coordinate block not in use. * * All coordinates must be in millipoints. */ public int ScanString(string str, PlotType flags, OS.Coord offset, OS.Matrix matrix, int length, OS.Coord offsetReturn, out int splitCount) { flags |= PlotType.GivenMatrix | PlotType.GivenFont; flags &= ~(PlotType.GivenBlock | PlotType.ReturnBBox); return(Font.ScanString(Handle, str, flags, offset, null, matrix, length, offsetReturn, out splitCount)); }
/*! \brief Return information on a string. * \param[in] str String to scan * \param[in] flags Plot type * \param[in] offset Offset of mouse click * \param[in,out] coordBlock Coordinate block * \param[in,out] matrix Transformation matrix * \param[in] length Length of string to scan - if \b PlotType.GivenLength (bit 7) of flags set * \param[out] offsetReturn x,y coordinate offset to caret position - * if \b PlotType.ReturnCaretPos (bit 17) of flags set; else to split point, * or end of string if splitting not required * \param[out] splitCount Number of split characters encountered - * if \b PlotType.ReturnSplitCount (bit 20) of flags set * \return Index of point in string of caret position - if \b PlotType.ReturnCaretPos * (bit 17) of flags is set; else of split point, or of end of string if splitting * not required. * * \note * Automatically: * \li Sets flag bit 5 to indicate coordinate block in use * \li Sets flag bit 6 to indicate transformation matrix in use * \li Sets flag bit 8 to indicate font handle in use * * All coordinates must be in millipoints. */ public int ScanString(string str, PlotType flags, OS.Coord offset, Font.ScanCoordBlock coordBlock, OS.Matrix matrix, int length, OS.Coord offsetReturn, out int splitCount) { flags |= PlotType.GivenBlock | PlotType.GivenMatrix | PlotType.GivenFont; return(Font.ScanString(Handle, str, flags, offset, coordBlock, matrix, length, offsetReturn, out splitCount)); }
internal static extern IntPtr Drawfile_GetBBox(int flags, [In] byte [] drawfile, int size, [In] OS.Matrix matrix, [Out] OS.Rect bbox_out);
internal static extern IntPtr Drawfile_Render(Drawfile.RenderFlags flags, [In] byte [] drawfile, int size, [In] OS.Matrix matrix, IntPtr clip, int flatness);