NetSurf
|
win32 plotter implementation. More...
#include "utils/config.h"
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <windows.h>
#include "utils/log.h"
#include "utils/utf8.h"
#include "netsurf/mouse.h"
#include "netsurf/window.h"
#include "netsurf/plotters.h"
#include "windows/bitmap.h"
#include "windows/font.h"
#include "windows/gui.h"
#include "windows/plot.h"
Go to the source code of this file.
Functions | |
static nserror | plot_block (COLORREF col, int x, int y, int width, int height) |
bitmap helper to plot a solid block of colour More... | |
static nserror | plot_alpha_bitmap (HDC hdc, struct bitmap *bitmap, int x, int y, int width, int height) |
plot an alpha blended bitmap More... | |
static nserror | plot_bitmap (struct bitmap *bitmap, int x, int y, int width, int height) |
Internal bitmap plotting. More... | |
static nserror | clip (const struct redraw_context *ctx, const struct rect *clip) |
Sets a clip rectangle for subsequent plot operations. More... | |
static nserror | arc (const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius, int angle1, int angle2) |
Plots an arc. More... | |
static nserror | disc (const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius) |
Plots a circle. More... | |
static nserror | line (const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line) |
Plots a line. More... | |
static nserror | rectangle (const struct redraw_context *ctx, const plot_style_t *style, const struct rect *rect) |
Plots a rectangle. More... | |
static nserror | polygon (const struct redraw_context *ctx, const plot_style_t *style, const int *p, unsigned int n) |
Plot a polygon. More... | |
static nserror | path (const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6]) |
Plots a path. More... | |
static nserror | bitmap (const struct redraw_context *ctx, struct bitmap *bitmap, int x, int y, int width, int height, colour bg, bitmap_flags_t flags) |
Plot a bitmap. More... | |
static nserror | text (const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length) |
Text plotting. More... | |
Variables | |
HDC | plot_hdc |
static RECT | plot_clip |
currently set clipping rectangle More... | |
const struct plotter_table | win_plotters |
win32 API plot operation table More... | |
win32 plotter implementation.
Definition in file plot.c.
|
static |
Plots an arc.
plot an arc segment around (x,y), anticlockwise from angle1 to angle2. Angles are measured anticlockwise from horizontal, in degrees.
ctx | The current redraw context. |
style | Style controlling the arc plot. |
x | The x coordinate of the arc. |
y | The y coordinate of the arc. |
radius | The radius of the arc. |
angle1 | The start angle of the arc. |
angle2 | The finish angle of the arc. |
Definition at line 387 of file plot.c.
References M_PI, NSERROR_INVALID, NSERROR_OK, NSLOG, plot_clip, plot_hdc, and plot_style_s::stroke_colour.
|
static |
Plot a bitmap.
Tiled plot of a bitmap image. (x,y) gives the top left coordinate of an explicitly placed tile. From this tile the image can repeat in all four directions – up, down, left and right – to the extents given by the current clip rectangle.
The bitmap_flags say whether to tile in the x and y directions. If not tiling in x or y directions, the single image is plotted. The width and height give the dimensions the image is to be scaled to.
ctx | The current redraw context. |
bitmap | The bitmap to plot |
x | The x coordinate to plot the bitmap |
y | The y coordiante to plot the bitmap |
width | The width of area to plot the bitmap into |
height | The height of area to plot the bitmap into |
bg | the background colour to alpha blend into |
flags | the flags controlling the type of plot operation |
TODO: Currently using top left pixel. Maybe centre pixel or average value would be better.
Definition at line 857 of file plot.c.
References BITMAPF_REPEAT_X, BITMAPF_REPEAT_Y, bitmap::height, height, NSERROR_OK, NSLOG, bitmap::opaque, bitmap::pixdata, plot_bitmap(), plot_block(), plot_clip, bitmap::width, and width.
Referenced by amiga_bitmap_create(), amiga_bitmap_destroy(), amiga_bitmap_get_buffer(), amiga_bitmap_get_opaque(), amiga_bitmap_get_rowstride(), amiga_bitmap_modified(), amiga_bitmap_set_opaque(), amiga_icon_from_bitmap(), atari_bitmap_buffer_size(), atari_bitmap_create_ex(), atari_bitmap_destroy(), atari_bitmap_get_height(), atari_bitmap_get_opaque(), atari_bitmap_get_rowstride(), atari_bitmap_get_width(), bitmap_destroy(), bitmap_get_buffer(), bitmap_get_height(), bitmap_get_opaque(), bitmap_get_rowstride(), bitmap_get_width(), bitmap_modified(), bitmap_set_opaque(), browser_window_history_get_thumbnail(), content__get_bitmap(), framebuffer_bitmap_get_opaque(), gif_content_is_opaque(), gif_get_bitmap(), gif_redraw(), image_cache_add(), jpeg_cache_convert(), jpegxl_cache_convert(), knockout_plot_bitmap(), make_toolbar_item_websearch(), plot_bitmap(), png_cache_convert(), riscos_bitmap_create(), ro_gui_save_create_thumbnail(), ro_gui_window_iconise(), rsvg_cache_convert(), NSResizeKnob::SetBitmap(), NSThrobber::SetBitmap(), webp_cache_convert(), win32_bitmap_create(), and win32_bitmap_destroy().
|
static |
Sets a clip rectangle for subsequent plot operations.
ctx | The current redraw context. |
clip | The rectangle to limit all subsequent plot operations within. |
Definition at line 357 of file plot.c.
References clip(), NSERROR_OK, NSLOG, and plot_clip.
Referenced by ablend_pixel(), about_userdraw(), ami_clip(), ami_do_redraw_tiled(), atari_cookie_manager_draw(), atari_global_history_draw(), atari_hotlist_draw(), atari_treeview_redraw(), bitmap_convert_tc(), browser_window_place_caret(), browser_window_redraw(), clip(), content_redraw(), content_scaled_redraw(), cookie_manager_redraw(), fb_cw_draw_event(), fb_redraw(), fbtk_clip_rect(), form_clip_inside_select_menu(), form_redraw_select_menu(), framebuffer_plot_clip(), gif_redraw(), global_history_redraw(), gui_get_clipboard(), gui_set_clipboard(), gui_window_place_caret(), hotlist_redraw(), html_redraw(), html_redraw_background(), html_redraw_border_plot(), html_redraw_borders(), html_redraw_box(), html_redraw_box_children(), html_redraw_inline_background(), html_redraw_inline_borders(), html_redraw_text_box(), html_set_focus(), image_bitmap_plot(), image_cache_redraw(), knockout_plot_clip(), local_history_redraw(), monkey_plot_clip(), monkey_window_handle_redraw(), nsbeos_plot_clip(), nsbeos_window_expose_event(), nsgtk_cw_draw_event(), nsgtk_plot_clip(), nsgtk_print_plot_clip(), nsgtk_window_draw_event(), nsico_redraw(), nsw32_corewindow_paint(), nsws_drawable_paint(), on_aes_event(), on_redraw(), on_redraw_event(), page_info_redraw(), plot_bitmap(), plot_blit_bitmap(), plot_clip(), plot_clipped_rectangle(), plot_get_clip_grect(), plot_init(), print_declare_fonts(), print_document(), print_draw_next_page(), redraw_entry(), ro_gui_progress_bar_redraw_window(), ro_gui_url_bar_redraw(), ro_gui_window__redraw_rect(), ro_plot_clip(), scrollbar_redraw(), svg_redraw(), svg_redraw_tiled_internal(), text_draw(), text_redraw(), textarea_redraw(), textplain_redraw(), toolbar_key_input(), toolbar_redraw(), toolbar_redraw_cb(), treeview_redraw(), window_redraw_content(), and window_redraw_favicon().
|
static |
Plots a circle.
Plot a circle centered on (x,y), which is optionally filled.
ctx | The current redraw context. |
style | Style controlling the circle plot. |
x | x coordinate of circle centre. |
y | y coordinate of circle centre. |
radius | circle radius. |
Definition at line 500 of file plot.c.
References plot_style_s::fill_colour, plot_style_s::fill_type, NSERROR_INVALID, NSERROR_OK, NSLOG, plot_clip, plot_hdc, PLOT_OP_TYPE_NONE, and plot_style_s::stroke_colour.
|
static |
Plots a line.
plot a line from (x0,y0) to (x1,y1). Coordinates are at centre of line width/thickness.
ctx | The current redraw context. |
style | Style controlling the line plot. |
line | A rectangle defining the line to be drawn |
Definition at line 579 of file plot.c.
References line(), NSERROR_INVALID, NSERROR_OK, NSLOG, plot_clip, plot_hdc, PLOT_OP_TYPE_DASH, PLOT_OP_TYPE_DOT, plot_style_fixed_to_int, plot_style_s::stroke_colour, plot_style_s::stroke_type, and plot_style_s::stroke_width.
Referenced by __assert2(), ami_line(), ami_memory_slab_stats_cb(), duk__emit_op_only(), duk__error_getter_helper(), duk_err_create_and_throw(), duk_error_raw(), fb_redraw(), fb_redraw_text(), fb_redraw_text_button(), framebuffer_plot_line(), get_key_value(), gtk_fetch_filetype_init(), gtk_print_font_paint(), knockout_plot_line(), layout_flex__build_line(), layout_flex__collect_items_into_lines(), layout_flex__distribute_free_main(), layout_flex__get_min_max_violations(), layout_flex__item_freeze(), layout_flex__place_line_items_cross(), layout_flex__place_line_items_main(), layout_flex__place_lines(), layout_flex__remaining_free_main(), layout_flex__resolve_line(), line(), llcache_process_metadata(), monkey_fetch_filetype_init(), monkey_plot_line(), nsbeos_plot_line(), nsfont_paint(), nsfont_split(), nsgtk_plot_line(), nsgtk_print_plot_line(), optionline(), plot_line(), ro_gui_ieurl_file_parse(), ro_gui_uri_file_parse(), ro_gui_url_complete_redraw(), ro_gui_url_file_parse(), ro_plot_line(), ro_textarea_redraw_internal(), ro_textarea_set_caret_xy(), scrollbar_rectangle(), textarea_get_b_off_xy(), textarea_keypress(), textarea_redraw(), textarea_reflow_multiline(), textplain_coords_from_range(), textplain_find_line(), textplain_get_line(), textplain_offset_from_coords(), textplain_redraw(), textplain_reformat(), textplain_textsearch_find(), xdg_get_default_app(), and xdg_get_exec_cmd().
|
static |
Plots a path.
Path plot consisting of cubic Bezier curves. Line and fill colour is controlled by the plot style.
ctx | The current redraw context. |
pstyle | Style controlling the path plot. |
p | elements of path |
n | nunber of elements on path |
transform | A transform to apply to the path. |
Definition at line 821 of file plot.c.
References NSERROR_OK, and NSLOG.
Referenced by ami_file_set_type(), ami_gui_map_filename(), amiga_basename(), amiga_bitmap_save(), amiga_icon_superimpose_favicon(), amiga_nsurl_to_path(), amiga_path_to_nsurl(), atari_basename(), atari_nsurl_to_path(), atari_path_to_nsurl(), browser_window__navigate_internal(), check_dirname(), check_homedir(), cookie_manager_delete_entry(), download_ro_filetype(), expand_path(), fetch_filetype(), fetch_resource_finalise(), fetch_resource_initialise(), fetch_resource_setup(), file_select(), filepath_path_to_strvec(), filesize(), find_app_resources(), find_resource(), gemdos_realpath(), gen_nice_title(), get_resource_url(), global_history_export(), gui_default_mimetype(), gui_default_pdf_password(), gui_get_resource_url(), gui_init(), handle_filesystem_select_button(), hash_add_file(), hotlist_export(), hotlist_get_temp_path(), hotlist_load(), hotlist_populate(), hotlist_save(), html_css_fetcher_setup(), is_dir(), is_internal_navigate_url(), main(), menu_save_page(), messages_add_from_file(), messages_load_ctx(), mouse_action_drag_none(), netsurf_path_to_nsurl(), netsurf_recursive_rm(), nsbeos_find_app_path(), nsbeos_gui_view_source(), nsbeos_scaffolding_dispatch_event(), nsgtk_download_tree_view_row_activated(), nsgtk_get_resource_url(), nsgtk_PDF_no_pass(), nsgtk_pdf_password(), nsgtk_PDF_set_pass(), nsgtk_saveas_dialog(), nsoption_read(), nsoption_write(), nsw32_get_resource_data(), nsw32_get_resource_url(), posix_basename(), posix_nsurl_to_path(), posix_path_to_nsurl(), realpath(), riscos_basename(), riscos_bitmap_save(), ro_filetype_from_unix_path(), ro_gui_choose_language(), ro_gui_create_dirs(), ro_gui_default_language(), ro_gui_download_canonicalise(), ro_gui_download_remember_dir(), ro_gui_save_clipboard(), ro_gui_save_complete(), ro_gui_save_content(), ro_gui_save_datasave_ack(), ro_gui_save_link(), ro_gui_save_object_native(), ro_gui_save_ok(), ro_gui_save_set_file_type(), ro_nsurl_to_path(), ro_path_to_nsurl(), ro_plot_draw_path(), ro_plot_line(), ro_plot_path(), ro_plot_polygon(), ro_plot_rectangle(), save_as_text(), save_complete(), save_complete_ctx_initialise(), savepage_button_clicked_cb(), scrap_txt_read(), select_filepath(), url_to_path(), urldb_delete_cookie(), urldb_delete_cookie_hosts(), urldb_delete_cookie_paths(), urldb_get_cookie(), urldb_load_cookies(), urldb_match_path(), urldb_parse_cookie(), urldb_save_search_tree(), urldb_set_cookie(), urldb_write_paths(), utf8_save_text(), windows_basename(), windows_nsurl_to_path(), windows_path_to_nsurl(), xdg_get_default_app(), and xdg_get_exec_cmd().
|
static |
plot an alpha blended bitmap
blunt force truma way of achiving alpha blended plotting
hdc | drawing cotext |
bitmap | bitmap to render |
x | x coordinate to plot at |
y | y coordinate to plot at |
width | The width to plot the bitmap into |
height | The height to plot the bitmap into |
Definition at line 120 of file plot.c.
References bitmap_scale(), bitmap::height, height, NSERROR_INVALID, NSERROR_OK, NSLOG, bitmap::pixdata, plot_clip, bitmap::width, width, and bitmap::windib.
Referenced by plot_bitmap().
Internal bitmap plotting.
bitmap | The bitmap to plot |
x | x coordinate to plot at |
y | y coordinate to plot at |
width | The width to plot the bitmap into |
height | The height to plot the bitmap into |
Definition at line 276 of file plot.c.
References bitmap::height, height, NSERROR_INVALID, NSERROR_OK, NSLOG, bitmap::opaque, bitmap::pbmi, bitmap::pixdata, plot_alpha_bitmap(), plot_clip, plot_hdc, bitmap::width, and width.
Referenced by bitmap().
|
static |
bitmap helper to plot a solid block of colour
col | colour to plot with |
x | the x coordinate to plot at |
y | the y coordinate to plot at |
width | the width of block to plot |
height | the height to plot |
Definition at line 61 of file plot.c.
References height, NSERROR_INVALID, NSERROR_OK, NSLOG, plot_clip, plot_hdc, and width.
Referenced by bitmap().
|
static |
Plot a polygon.
Plots a filled polygon with straight lines between points. The lines around the edge of the ploygon are not plotted. The polygon is filled with the non-zero winding rule.
ctx | The current redraw context. |
style | Style controlling the polygon plot. |
p | verticies of polygon |
n | number of verticies. |
Definition at line 733 of file plot.c.
References plot_style_s::fill_colour, NSERROR_INVALID, NSERROR_OK, NSLOG, plot_clip, plot_hdc, point_s::x, and point_s::y.
|
static |
Plots a rectangle.
The rectangle can be filled an outline or both controlled by the plot style The line can be solid, dotted or dashed. Top left corner at (x0,y0) and rectangle has given width and height.
ctx | The current redraw context. |
style | Style controlling the rectangle plot. |
rect | A rectangle defining the line to be drawn |
Definition at line 648 of file plot.c.
References plot_style_s::fill_colour, plot_style_s::fill_type, NSERROR_INVALID, NSERROR_OK, NSLOG, plot_clip, plot_hdc, PLOT_OP_TYPE_DASH, PLOT_OP_TYPE_DOT, PLOT_OP_TYPE_NONE, plot_style_fixed_to_int, plot_style_s::stroke_colour, plot_style_s::stroke_type, plot_style_s::stroke_width, rect::x0, rect::x1, rect::y0, and rect::y1.
|
static |
Text plotting.
ctx | The current redraw context. |
fstyle | plot style for this text |
x | x coordinate |
y | y coordinate |
text | UTF-8 string to plot |
length | length of string, in bytes |
Definition at line 978 of file plot.c.
References plot_font_style::background, plot_font_style::foreground, get_font(), NSERROR_INVALID, NSERROR_OK, NSLOG, plot_clip, plot_hdc, and text().
Referenced by ami_clipboard_cat_collection(), ami_easy_clipboard(), ami_gui_opts_event(), ami_search_string(), ami_text(), atari_window_set_status(), beos_warn_user(), box_construct_text(), box_select_add_option(), box_textarea_create_textarea(), browser_window_set_status(), create_login_window(), die(), fb_url_enter(), fbtk_set_text(), find_occurrences_html_box(), form_add_option(), framebuffer_plot_text(), gui_download_window_create(), gui_get_clipboard(), gui_set_clipboard(), gui_window_set_status(), html_redraw_file(), knockout_plot_text(), monkey_plot_text(), nsbeos_about(), nsbeos_plot_text(), nsbeos_scaffolding_dispatch_event(), nsgtk_combo_box_text_append_text(), nsgtk_download_update(), nsgtk_plot_text(), nsgtk_print_plot_text(), options_general_dialog_handler(), plot_text(), print_fonts_plot_text(), riscos_window_set_status(), ro_gui_menu_define_menu_add(), ro_gui_options_connection_proxy_type(), ro_gui_options_image_read(), ro_gui_set_icon_string(), ro_gui_set_window_title(), ro_gui_status_bar_set_text(), ro_gui_wimp_event_prepare_gright_menu(), ro_plot_text(), ro_textarea_insert_text(), ro_textarea_reflow(), ro_textarea_replace_text(), ro_textarea_set_text(), save_complete_node_handler(), save_text_add_to_buffer(), sb_set_text(), selection_copy_box(), selection_string_append(), set_text(), text(), text_draw(), textarea_char_to_byte_offset(), textarea_drop_text(), textarea_get_text(), textarea_insert_text(), textarea_reflow_multiline(), textarea_set_text(), textplain_clone(), textplain_close(), textplain_convert(), textplain_coord_from_offset(), textplain_coords_from_range(), textplain_create(), textplain_destroy(), textplain_find_line(), textplain_get_line(), textplain_get_raw_data(), textplain_get_selection(), textplain_keypress(), textplain_line_count(), textplain_mouse_action(), textplain_mouse_track(), textplain_offset_from_coords(), textplain_open(), textplain_process_data(), textplain_redraw(), textplain_reformat(), textplain_textsearch_find(), textplain_textselection_copy(), textplain_textselection_get_end(), toolbar_key_input(), toolbar_set_url(), treeview__create_textarea(), treeview__search(), treeview_node_selection_walk_cb(), win32_window_set_status(), and window_set_stauts().
|
static |
currently set clipping rectangle
Definition at line 47 of file plot.c.
Referenced by arc(), bitmap(), clip(), disc(), line(), plot_alpha_bitmap(), plot_bitmap(), plot_block(), polygon(), rectangle(), and text().
HDC plot_hdc |
Definition at line 44 of file plot.c.
Referenced by arc(), bitmap_render(), disc(), line(), nsw32_corewindow_paint(), nsws_drawable_paint(), plot_bitmap(), plot_block(), polygon(), rectangle(), and text().
const struct plotter_table win_plotters |
win32 API plot operation table
Definition at line 1040 of file plot.c.
Referenced by bitmap_render(), nsw32_cookie_draw(), nsw32_global_history_draw(), nsw32_hotlist_draw(), nsw32_local_history_draw(), and nsws_drawable_paint().