/* * File: Display_Render_Simple.c * * Created: Created: Saturday September 2025 09:22:12 * Author: Chris */ #include "Display_Render_Simple.h" // ============================================================================================ // Includes #include "Display_Font.h" #include "Display_Color.h" #include "Display_Image.h" // ============================================================================================ // Variables static Screen_Transition_Settings_t* _Transition_Settings; // ============================================================================================ // Function Declarations /******************************************************************* Functions *******************************************************************/ void Display_Render_Simple_Init(Screen_Transition_Settings_t* transition_settings) { _Transition_Settings = transition_settings; } void Display_Render_Simple_Float(Coordinates* coordinates_object, Object_Float* float_data) { char String[64]; uint32_t String_Char_Count; Display_Font_Set_Font(float_data->Font->Font); String_Char_Count = sprintf(String, float_data->Format, *(float_data->Value)); Display_Font_Print_String(coordinates_object->X, coordinates_object->Y, String, String_Char_Count, float_data->Font->Character_Spacing, float_data->Color); } void Display_Render_Simple_Integer(Coordinates* coordinates_object, Object_Integer* integer_data) { char String[64]; uint32_t String_Char_Count; Display_Font_Set_Font(integer_data->Font->Font); String_Char_Count = sprintf(String, integer_data->Format, *(integer_data->Value)); Display_Font_Print_String(coordinates_object->X, coordinates_object->Y, String, String_Char_Count, integer_data->Font->Character_Spacing, integer_data->Color); } void Display_Render_Simple_Text(Coordinates* coordinates_object, Object_Text* text_data) { char String[64]; uint32_t String_Char_Count; Display_Font_Set_Font(text_data->Font->Font); sprintf(String, "%s", text_data->Text); String_Char_Count = text_data->Length; Display_Font_Print_String(coordinates_object->X, coordinates_object->Y, String, String_Char_Count, text_data->Font->Character_Spacing, text_data->Color); } void Display_Render_Simple_Image(Coordinates* coordinates_object, Object_Image_Color* image) { if(image->Rotation_Angle == 0) { Display_Image_Draw_Color_Alpha(coordinates_object->X, coordinates_object->Y, image->Image, image->Alpha); } else { Display_Image_Draw_Color_Rotated_Alpha(coordinates_object->X, coordinates_object->Y, image->Image, image->Rotation_Angle, image->Alpha); } } void Display_Render_Simple_Bool(Coordinates* coordinates_object, Object_Bool* bool_data) { char String[64]; uint32_t String_Char_Count; Display_Color Color; Display_Font_Set_Font(bool_data->Font->Font); if(*bool_data->Value == true) { sprintf(String, "%s", bool_data->Text_True); String_Char_Count = bool_data->Length_True; Color = bool_data->Color_True; } else { sprintf(String, "%s", bool_data->Text_False); String_Char_Count = bool_data->Length_False; Color = bool_data->Color_False; } Display_Font_Print_String(coordinates_object->X, coordinates_object->Y, String, String_Char_Count, bool_data->Font->Character_Spacing, Color); } void Display_Render_Simple_Shape(Coordinates* coordinates_object, Object_Shape* shape) { int16_t X1, X2, Y1, Y2; switch (shape->Type) { case RECTANGLE_FILLED: Display_Shapes_Draw_Rect_Filled(coordinates_object->X, coordinates_object->Y, shape->Dimension.Width, shape->Dimension.Height, shape->Color); break; case RECTANGLE_FRAME: Display_Shapes_Draw_Rect_Frame(coordinates_object->X, coordinates_object->Y, shape->Dimension.Width, shape->Dimension.Height, shape->Thickness, shape->Color); break; case ROUNDED_RECTANGLE_FILLED: Display_Shapes_Draw_Round_Rect_Filled(coordinates_object->X, coordinates_object->Y, shape->Dimension.Width, shape->Dimension.Height, shape->Radius_Start, shape->Color); break; case ROUNDED_RECTANGLE_FRAME: Display_Shapes_Draw_Round_Rect_Frame(coordinates_object->X, coordinates_object->Y, shape->Dimension.Width, shape->Dimension.Height, shape->Radius_Start, shape->Thickness, shape->Color); break; case CIRCLE_FILLED: Display_Shapes_Draw_Circle_Filled(coordinates_object->X, coordinates_object->Y, shape->Radius_Start, shape->Color); break; case CIRCLE_FRAME: Display_Shapes_Draw_Circle_Frame(coordinates_object->X, coordinates_object->Y, shape->Radius_Start, shape->Thickness, shape->Color); break; case ARC: Display_Shapes_Draw_Arc_Frame(coordinates_object->X, coordinates_object->Y, shape->Radius_Start, shape->Thickness, shape->Angle_Start, shape->Angle_End, shape->Draw_Steps, shape->Color); break; case LINE_XY: X2 = shape->Angle_Start - _Transition_Settings->Offset.X; // Angle Start contains X2 Y2 = shape->Angle_End - _Transition_Settings->Offset.Y; // Angle End contains Y2 Display_Shapes_Draw_Line_XY(coordinates_object->X, coordinates_object->Y, X1, Y2, shape->Thickness, shape->Color); break; case LINE_RAD: Display_Shapes_Draw_Line_Rad(coordinates_object->X, coordinates_object->Y, shape->Angle_Start, shape->Radius_Start, shape->Radius_End, shape->Thickness, shape->Color); break; } } /******************************************************************* Internal Functions *******************************************************************/