From cdbe66d2c7da7c4ec49d7da790653744e3595b71 Mon Sep 17 00:00:00 2001 From: m1maker Date: Thu, 2 Jan 2025 13:44:29 +0300 Subject: [PATCH] Document new methods. * Loading/closing for font and surface. --- .../Namespaces/Global/Classes/renderer.md | 8 ++-- .../Namespaces/Global/Classes/surface.md | 45 ++++++++++++++----- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/docs/Foundation/Namespaces/Global/Classes/renderer.md b/docs/Foundation/Namespaces/Global/Classes/renderer.md index 005b42a..57109df 100644 --- a/docs/Foundation/Namespaces/Global/Classes/renderer.md +++ b/docs/Foundation/Namespaces/Global/Classes/renderer.md @@ -51,21 +51,19 @@ The `renderer` class provides a data structure for handling rendering operations - **Return Type**: texture@ - **Description**: Returns the current rendering target as a property. -### `bool set_logical_presentation(int w, int h, rendererlogicalpresentation mode, scalemode scale_mode)` +### `bool set_logical_presentation(int w, int h, rendererlogicalpresentation mode)` - **Parameters**: - `w` (int): The logical width. - `h` (int): The logical height. - `mode` (rendererlogicalpresentation): The presentation mode. - - `scale_mode` (scalemode): The scaling mode. -- **Return Type**: bool + **Return Type**: bool - **Description**: Sets the logical presentation properties of the renderer. -### `bool get_logical_presentation(int&out w, int&out h, rendererlogicalpresentation&out mode, scalemode&out scale_mode)` +### `bool get_logical_presentation(int&out w, int&out h, rendererlogicalpresentation&out mode)` - **Parameters**: - `w` (int&out): Output parameter for the logical width. - `h` (int&out): Output parameter for the logical height. - `mode` (rendererlogicalpresentation&out): Output parameter for the presentation mode. - - `scale_mode` (scalemode&out): Output parameter for the scaling mode. - **Return Type**: bool - **Description**: Retrieves the logical presentation properties of the renderer. diff --git a/docs/Foundation/Namespaces/Global/Classes/surface.md b/docs/Foundation/Namespaces/Global/Classes/surface.md index 1b15bfa..d7aaa23 100644 --- a/docs/Foundation/Namespaces/Global/Classes/surface.md +++ b/docs/Foundation/Namespaces/Global/Classes/surface.md @@ -4,29 +4,52 @@ The `surface` class provides a data structure for handling bitmap images and sur ## Constructors -### `surface(int width, int height, pixelformat format)` +### `surface(int width, int height, pixelformat format, const string&in pixels, int pitch)` - **Parameters**: - `width` (int): The width of the surface. - `height` (int): The height of the surface. - `format` (pixelformat): The pixel format for the surface. -- **Description**: Constructs a new `surface` object with the specified dimensions and pixel format. - -### `surface(int width, int height, pixelformat format, uint64 pixels, int pitch)` -- **Parameters**: - - `width` (int): The width of the surface. - - `height` (int): The height of the surface. - - `format` (pixelformat): The pixel format for the surface. - - `pixels` (uint64): The memory buffer containing the pixel data. + - `pixels` (string): The memory buffer containing the pixel data. - `pitch` (int): The pitch of the pixel data. - **Description**: Constructs a new `surface` object with the specified dimensions, pixel format, and initial pixel data. ### `surface(const string&in filename)` - **Parameters**: - - `filename` (const string&): The path to the image file. -- **Description**: Constructs a new `surface` object by loading an image from a file. + - `filename` (const string&): The path to the BMP file. +- **Description**: Constructs a new `surface` object by loading an image from a BMP file. ## Methods + +### `bool load_bmp(const string& filename)` +- **Parameters**: + - `filename` (string): The path to the BMP file to be loaded. +- **Return Type**: bool +- **Description**: Loads a BMP image from the specified file and returns `true` if successful; otherwise, returns `false`. + +### `bool load_from_pixels(int width, int height, pixelformat format, const string& pixels, int pitch)` +- **Parameters**: + - `width` (int): The width of the pixel data. + - `height` (int): The height of the pixel data. + - `format` (pixelformat): The pixel format of the data. + - `pixels` (string): The pixel data as a string. + - `pitch` (int): The pitch of the pixel data. +- **Return Type**: bool +- **Description**: Loads an image from raw pixel data and returns `true` if successful; otherwise, returns `false`. + +### `bool load_from_memory(const string& data, uint64 size)` +- **Parameters**: + - `data` (string): The memory buffer containing the image data. + - `size` (uint64): The size of the memory buffer in bytes. +- **Return Type**: bool +- **Description**: Loads an image from a memory buffer and returns `true` if successful; otherwise, returns `false`. + +### `void close()` +- **Parameters**: + - None +- **Return Type**: void +- **Description**: Closes the surface and releases any resources associated with it. + ### `void set_colorspace(int colorspace) const property` - **Parameters**: - `colorspace` (int): The new color space.