note description: "Representation of an image that can be paste on other image." author: "Louis Marchand" date: "Sat, 28 Mar 2015 14:00:33 +0000" revision: "2.0" class interface GAME_SURFACE create make, share_from_image, make_from_image, share_from_other, make_from_other, make_for_window, make_for_display, make_for_display_mode, make_for_pixel_format, make_with_masks feature -- Access is_locked: BOOLEAN -- Current is locked to access pixels. Current cannot be used until unlock is called. must_lock: BOOLEAN -- Current must be locked for pixel access lock -- Lock Current to access pixels. -- Must used unlock after the edition. -- You cannot draw on Current while locked. ensure is_locked: not has_error implies is_locked unlock -- Unlock Current after access pixels. require is_locked: is_locked ensure not_locked: not is_locked pixels: GAME_PIXEL_READER_WRITER -- Used to fetch and edit pixels in Current -- Use lock before to access multiple pixels require locked_if_needed: must_lock implies is_locked image: GAME_IMAGE -- The GAME_IMAGE that has served for creating Current is_open: BOOLEAN -- Current has been opened properly as_converted_to_pixel_format (a_pixel_format: GAME_PIXEL_FORMAT_READABLE): GAME_SURFACE -- Create a copy of Current conforming to a_pixel_format. require surface_is_video_enable: Game_library.is_video_enable surface_convert_is_open: is_open not_locked: not is_locked pixel_format: GAME_PIXEL_FORMAT_READABLE -- The internal format of the pixel representation in memory. require surface_is_video_enable: Game_library.is_video_enable surface_pixel_format_is_open: is_open draw_surface (a_other: GAME_SURFACE; a_x, a_y: INTEGER_32) -- Draw the whole surface a_other on Current at (a_x,a_y). require surface_is_video_enable: Game_library.is_video_enable surface_draw_is_open: is_open not_locked: not is_locked draw_sub_surface (a_other: GAME_SURFACE; a_x_source, a_y_source, a_width, a_height, a_x_destination, a_y_destination: INTEGER_32) -- Draw on Current at (a_x_destination,a_y_destination) the portion of a_other -- starting at (a_x_source,a_y_source) with dimension a_width x a_height. require surface_is_video_enable: Game_library.is_video_enable surface_draw_is_open: is_open not_locked: not is_locked draw_sub_surface_with_scale (a_other: GAME_SURFACE; a_x_source, a_y_source, a_width_source, a_height_source, a_x_destination, a_y_destination, a_width_destination, a_height_destination: INTEGER_32) -- Draw on Current at (a_x_destination,a_y_destination) the portion of a_other -- starting at (a_x_source,a_y_source) with dimension a_width x a_height. -- Will scale a_other using a_width_destination and a_height_destination require surface_is_video_enable: Game_library.is_video_enable surface_draw_is_open: is_open not_locked: not is_locked draw_rectangle (a_color: GAME_COLOR; a_x, a_y, a_width, a_height: INTEGER_32) -- Draw a a_color rectangle of dimension a_width x a_height on Current at (a_x,a_y). require surface_is_video_enable: Game_library.is_video_enable surface_draw_is_open: is_open not_locked: not is_locked draw_rectangles (a_color: GAME_COLOR; a_rectangles: CHAIN [TUPLE [x: INTEGER_32; y: INTEGER_32; width: INTEGER_32; height: INTEGER_32]]) -- Drawing every a_color rectangle in a_rectangles -- that has it's left frontier at -- x, it's top frontier at y, with -- dimension widthxheight require surface_is_video_enable: Game_library.is_video_enable surface_draw_is_open: is_open not_locked: not is_locked transparent_color: GAME_COLOR_READABLE assign set_transparent_color -- The color that will be remove in the surface (the transparent color). require surface_is_video_enable: Game_library.is_video_enable surface_is_open: is_open surface_transparent_color_is_enable: is_transparent_enable not_locked: not is_locked set_transparent_color (a_color: GAME_COLOR_READABLE) -- Change all pixel of color color into transparency (and enable it). The transparency by color don't work if the surface -- have an alpha blending activated. require surface_is_video_enable: Game_library.is_video_enable surface_is_open: is_open not_locked: not is_locked is_transparent_enable: BOOLEAN -- Is transparency by color key is enabled. require surface_is_video_enable: Game_library.is_video_enable surface_is_open: is_open not_locked: not is_locked disable_transparent -- Remove the transparency by color key. require surface_is_video_enable: Game_library.is_video_enable surface_is_open: is_open not_locked: not is_locked height: INTEGER_32 -- The height of Current. require surface_is_open: is_open width: INTEGER_32 -- The width of Current. require surface_is_open: is_open overall_alpha: NATURAL_8 assign set_overall_alpha -- The Additionnal alpha value to use in drawing operation. require surface_is_open: is_open not_locked: not is_locked set_overall_alpha (a_overall_alpha: NATURAL_8) -- Assign the Additionnal overall_alpha value to use in drawing operation to a_overall_alpha. require surface_is_open: is_open not_locked: not is_locked color_multiplier: TUPLE [red_multipier: NATURAL_8; green_multipier: NATURAL_8; blue_multipier: NATURAL_8] -- The additional color value multiplied into drawing operations require surface_is_open: is_open not_locked: not is_locked set_color_multiplier (a_red_multiplier, a_green_multiplier, a_blue_multiplier: NATURAL_8) -- Assign the Additionnal color_multiplier value to use into drawing operation to a_red_multiplier, -- a_green_multiplier, a_blue_multiplier. require surface_is_open: is_open not_locked: not is_locked enable_rle_acceleration -- Enable possible optimisation when using drawing with transparent_color enabled or enable_alpha_blending. require surface_is_open: is_open not_locked: not is_locked disable_rle_acceleration -- Disable the possible optimisation when using drawing with transparent_color enabled or enable_alpha_blending. require surface_is_open: is_open not_locked: not is_locked save_bmp (a_filename: READABLE_STRING_GENERAL) -- Save Current into a BMP image file require surface_is_open: is_open invariant surface_valid: is_open implies image.is_open end -- class GAME_SURFACE
Generated by ISE EiffelStudio