INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

title: "General notion of a device context. ", "WEL: library of reusable components for Eiffel. ", "Based on WEL library for ISE Eiffel, used with permission. "
project: "Windows Eiffel Library"
copyright: "(c) 1986-1997 Interactive Software Engineering Inc. ", "Modifications and extensions: ", "(c) 1997-2001 Object Tools ", "All rights reserved. Duplication and distribution prohibited", "May be used only with Visual Eiffel under terms of user ", "license "
cluster: wel
deferred class WEL_DC
inherit

WEL_ANY
end

WEL_DT_CONSTANTS
export
{NONE}
all
end

WEL_RASTER_OPERATIONS_CONSTANTS
export
{NONE}
all
end

WEL_DIB_COLORS_CONSTANTS
export
{NONE}
all
{ANY}
valid_dib_colors_constant
end

WEL_STRETCH_MODE_CONSTANTS
export
{NONE}
all
{ANY}
valid_stretch_mode_constant
end

WEL_FLOOD_FILL_CONSTANTS
export
{NONE}
all
end

WEL_TA_CONSTANTS
export
{NONE}
all
{ANY}
valid_text_alignement_constant
end

WEL_MM_CONSTANTS
export
{NONE}
all
{ANY}
valid_map_mode_constant
end

WEL_POLYGON_FILL_MODE_CONSTANTS
export
{NONE}
all
{ANY}
valid_polygon_fill_mode_constant
end

WEL_ROP2_CONSTANTS
export
{NONE}
all
{ANY}
valid_rop2_constant
end

WEL_CAPABILITIES_CONSTANTS
export
{NONE}
all
end

WEL_WORD_OPERATIONS
export
{NONE}
all
redefine
pen
end
feature -- Access

pen: WEL_PEN

brush: WEL_BRUSH

palette: WEL_PALETTE

region: WEL_REGION

font: WEL_FONT

bitmap: WEL_BITMAP
feature -- Status report

pen_selected: BOOLEAN
-- Is a pen selected?

brush_selected: BOOLEAN
-- Is a brush selected?

palette_selected: BOOLEAN
-- Is a palette selected?

region_selected: BOOLEAN
-- Is a region selected?

font_selected: BOOLEAN
-- Is a font selected?

bitmap_selected: BOOLEAN
-- Is a bitmap selected?

is_transparent: BOOLEAN
-- Is the background mode transparent?
require
exists: exists

is_opaque: BOOLEAN
-- Is the background mode opaque?
require
exists: exists

background_color: WEL_COLOR_REF
-- Current color of the background
require
exists: exists
ensure
result_not_void: Result /= void

text_color: WEL_COLOR_REF
-- Current color of the text
require
exists: exists
ensure
result_not_void: Result /= void

rop2: INTEGER
-- Current drawing mode
require
exists: exists
ensure
valid_result: valid_rop2_constant (Result)

text_alignment: INTEGER
-- Current text alignement flags
require
exists: exists

pixel_color (x, y: INTEGER): WEL_COLOR_REF
-- Color located at `x', `y' position
require
exists: exists
ensure
result_not_void: Result /= void

viewport_origin: WEL_POINT
-- Viewport origin for the dc
require
exists: exists
ensure
result_not_void: Result /= void

viewport_extent: WEL_SIZE
-- Retrieve the size of the current viewport for the dc.
require
exists: exists
ensure
result_not_void: Result /= void

window_origin: WEL_POINT
-- Window origin for the dc
require
exists: exists
ensure
result_not_void: Result /= void

window_extent: WEL_SIZE
-- Window extent for the dc
require
exists: exists
ensure
result_not_void: Result /= void

position: WEL_POINT
-- Current position in logical coordinates
require
exists: exists
ensure
result_exists: Result /= void

string_size (s: STRING): WEL_SIZE
-- Size of the string `s' using the selected font
require
exists: exists
s_exists: s /= void
ensure
result_exists: Result /= void
positive_width: Result.width >= 0
positive_height: Result.height >= 0

string_width (s: STRING): INTEGER
-- Width of the string `s' using the selected font
require
exists: exists
s_exists: s /= void
ensure
positive_result: Result >= 0

string_height (s: STRING): INTEGER
-- Height of the string `s' using the selected font
require
exists: exists
s_exists: s /= void
ensure
positive_result: Result >= 0

tabbed_text_size (text: STRING): WEL_SIZE
-- Size of a tabbed `text'
require
exists: exists
text_not_void: text /= void
ensure
result_not_void: Result /= void
positive_width: Result.width >= 0
positive_height: Result.height >= 0

tabbed_text_width (text: STRING): INTEGER
-- Width of a tabbed `text'
require
exists: exists
text_not_void: text /= void
ensure
positive_width: Result >= 0

tabbed_text_height (text: STRING): INTEGER
-- Height of a tabbed `text'
require
exists: exists
text_not_void: text /= void
ensure
positive_height: Result >= 0

tabbed_text_size_with_tabulation (text: STRING; tabulations: ARRAY [INTEGER]): WEL_SIZE
-- Size of a tabbed `text', with `tabulations' as
-- tabulation positions.
require
exists: exists
text_not_void: text /= void
tabulations_not_void: tabulations /= void
ensure
result_not_void: Result /= void
positive_width: Result.width >= 0
positive_height: Result.height >= 0

device_caps (capability: INTEGER): INTEGER
-- Give device-specific information about
-- the current display device.
-- See class WEL_CAPABILITIES_CONSTANTS for
-- `capability' values and results.
require
exists: exists

map_mode: INTEGER
-- Current mapping mode
-- See class WEL_MM_CONSTANTS for values.
require
exists: exists
ensure
valid_map_mode: valid_map_mode_constant (Result)

polygon_fill_mode: INTEGER
-- Current polygon fill mode
-- See class WEL_POLYGON_FILL_MODE_CONSTANTS for values.
require
exists: exists
ensure
valid_polygon_fill_mode: valid_polygon_fill_mode_constant (Result)

valid_extent_map_mode (mode: INTEGER): BOOLEAN
-- Is `mode' a valid window or viewport extent map mode?
require
valid_map_mode: valid_map_mode_constant (mode)

stretch_blt_mode: INTEGER
-- Current stretching mode. The stretching mode
-- defines how color data is added to or removed from
-- bitmaps that are stretched or compressed when
-- `stretch_blt' is called.
require
exists: exists
ensure
valid_stretch_mode: valid_stretch_mode_constant (Result)

text_face: STRING
-- Typeface name of the font that is currently selected
require
exists: exists
ensure
result_not_void: Result /= void

width: INTEGER
-- Width of the screen (in pixels)
require
exists: exists

height: INTEGER
-- Height of screen (in raster lines)
require
exists: exists
feature -- Status setting

set_text_alignment (an_alignment: INTEGER)
-- Set the text alignment with `an_alignement'.
-- See class WEL_TA_CONSTANTS for `an_alignement'.
require
exists: exists
valid_alignement: valid_text_alignement_constant (an_alignment)
ensure
text_alignment_set: text_alignment = an_alignment

set_map_mode (mode: INTEGER)
-- Set the mapping mode `mode' of the device context.
-- See class WEL_MM_CONSTANTS for `mode' values.
require
exists: exists
valid_map_mode: valid_map_mode_constant (mode)
ensure
map_mode_set: map_mode = mode

set_polygon_fill_mode (mode: INTEGER)
-- Set the polygon fill mode `polygon_fill_mode' with
-- `mode'.
-- See class WEL_POLYGON_FILL_MODE_CONSTANTS for
-- `mode' values.
require
exists: exists
valid_polygon_fill_mode: valid_polygon_fill_mode_constant (mode)
ensure
polygon_fill_mode_set: polygon_fill_mode = mode

set_window_extent (x_extent, y_extent: INTEGER)
-- Set the `x_extent' and `y_extent' of the window
-- associated with the device context
require
exists: exists
valid_current_map_mode: valid_extent_map_mode (map_mode)
ensure
x_window_extent_set: window_extent.width = x_extent
y_window_extent_set: window_extent.height = y_extent

set_window_origin (x_origin, y_origin: INTEGER)
-- Set the `x_origin' and `y_origin' of the window
-- associated with the device context
require
exists: exists
ensure
x_window_origin_set: window_origin.x = x_origin
y_window_origin_set: window_origin.y = y_origin

set_viewport_extent (x_extent, y_extent: INTEGER)
-- Set the `x_extent' and `y_extent' of the viewport
-- associated with the device context
require
exists: exists
valid_current_map_mode: valid_extent_map_mode (map_mode)
ensure
x_viewport_extent_set: viewport_extent.width = x_extent
y_viewport_extent_set: viewport_extent.height = y_extent

set_viewport_origin (x_origin, y_origin: INTEGER)
-- Set the `x_origin' and `y_origin' of the viewport
-- associated with the device context
require
exists: exists
ensure
x_viewport_origin_set: viewport_origin.x = x_origin
y_viewport_origin_set: viewport_origin.y = y_origin

set_background_color (color: WEL_COLOR_REF)
-- Set the `background_color' to `color'
require
exists: exists
color_not_void: color /= void
ensure
color_set: background_color.item = color.item

set_text_color (color: WEL_COLOR_REF)
-- Set the `text_color' to `color'.
require
exists: exists
color_not_void: color /= void
ensure
color_set: text_color.item = color.item

set_background_opaque
-- Set the background mode to opaque
require
exists: exists
ensure
is_opaque: is_opaque

set_background_transparent
-- Set the background mode to transparent
require
exists: exists
ensure
is_transparent: is_transparent

set_rop2 (a_rop2: INTEGER)
-- Set the current foreground mix mode. GDI uses the
-- foreground mix mode to combine pens and interiors of
-- filled objects with the colors already on the screen.
-- The foreground mix mode defines how colors from the
-- brush or pen and the colors in the existing image
-- are to be combined.
-- For `a_rop2' values, see class WEL_ROP2_CONSTANTS.
require
exists: exists
valid_rop2_constant: valid_rop2_constant (a_rop2)
ensure
rop2_set: rop2 = a_rop2

set_stretch_blt_mode (a_mode: INTEGER)
-- Set the bitmap stretching mode with `a_mode'.
-- See class WEL_STRETCH_MODE_CONSTANTS for `a_mode'
-- values.
require
exists: exists
valid_stretch_mode_constant: valid_stretch_mode_constant (a_mode)
ensure
stretch_blt_mode_set: stretch_blt_mode = a_mode

select_palette (a_palette: WEL_PALETTE)
-- Select the `a_palette' as the current palette.
require
exists: exists
a_palette_not_void: a_palette /= void
a_palette_exists: a_palette.exists

select_pen (a_pen: WEL_PEN)
-- Select the `a_pen' as the current pen.
require
exists: exists
a_pen_not_void: a_pen /= void
a_pen_exists: a_pen.exists
ensure
pen_set: pen = a_pen
pen_selected: pen_selected

select_brush (a_brush: WEL_BRUSH)
-- Select the `a_brush' as the current brush.
require
exists: exists
a_brush_not_void: a_brush /= void
a_brush_exists: a_brush.exists
ensure
brush_set: brush = a_brush
brush_selected: brush_selected

select_region (a_region: WEL_REGION)
-- Select the `a_region' as the current region.
require
exists: exists
a_region_not_void: a_region /= void
a_region_exists: a_region.exists
ensure
region_set: region = a_region
region_selected: region_selected

select_font (a_font: WEL_FONT)
-- Select the `a_font' as the current font.
require
exists: exists
a_font_not_void: a_font /= void
a_font_exists: a_font.exists
ensure
font_set: font = a_font
font_selected: font_selected

select_bitmap (a_bitmap: WEL_BITMAP)
-- Select the `a_bitmap' as the current bitmap.
require
exists: exists
a_bitmap_not_void: a_bitmap /= void
a_bitmap_exists: a_bitmap.exists
ensure
bitmap_set: bitmap = a_bitmap
bitmap_selected: bitmap_selected

unselect_pen
-- Deselect the pen and restore the old one
require
exists: exists
pen_selected: pen_selected
ensure
pen_not_selected: not pen_selected

unselect_brush
-- Deselect the brush and restore the old one
require
exists: exists
brush_selected: brush_selected
ensure
brush_not_selected: not brush_selected

unselect_region
-- Deselect the region and restore the old one
require
exists: exists
region_selected: region_selected
ensure
region_not_selected: not region_selected

unselect_palette
-- Deselect the palette and restore the old one
require
exists: exists
palette_selected: palette_selected
ensure
palette_not_selected: not palette_selected

unselect_font
-- Deselect the font and restore the old one
require
exists: exists
font_selected: font_selected
ensure
font_not_selected: not font_selected

unselect_bitmap
-- Deselect the bitmap and restore the old one
require
exists: exists
bitmap_selected: bitmap_selected
ensure
bitmap_not_selected: not bitmap_selected

unselect_all
-- Deselect all objects and restore the old ones
require
exists: exists
ensure
pen_not_selected: not pen_selected
brush_not_selected: not brush_selected
region_not_selected: not region_selected
palette_not_selected: not palette_selected
font_not_selected: not font_selected
bitmap_not_selected: not bitmap_selected
feature -- Basic operations

realize_palette
-- Map palette entries from the current logical
-- palette on the system palette
require
exists: exists
palette_selected: palette_selected

select_clip_region (a_region: WEL_REGION)
-- Select `a_region' as the current clipping region
require
exists: exists
a_region_not_void: a_region /= void
a_region_exists: a_region.exists

text_out (x, y: INTEGER; a_string: STRING)
-- Write `string' on `x' and `y' position
require
exists: exists
string_not_void: a_string /= void

tabbed_text_out (x, y: INTEGER; a_string: STRING; tabulations: ARRAY [INTEGER]; tabulations_origin: INTEGER)
-- Write `string' on `x' and `y' position expanding
-- tabs to the values specified in `tabulations'.
-- `tabulations_origin' specifies the x-coordinate of
-- the starting position from which tabs are expanded.
require
exists: exists
string_not_void: a_string /= void
tabulations_not_void: tabulations /= void

draw_text (a_string: STRING; rect: WEL_RECT; format: INTEGER)
-- Draw the text `string' inside
-- the `rect' using `format'
-- See class WEL_DT_CONSTANTS for `format' value
require
exists: exists
string_not_void: a_string /= void
rect_not_void: rect /= void

draw_centered_text (a_string: STRING; rect: WEL_RECT)
-- Draw the text `string' centered in `rect'.
require
exists: exists
string_not_void: a_string /= void
rect_not_void: rect /= void

draw_bitmap (a_bitmap: WEL_BITMAP; x, y, a_width, a_height: INTEGER)
-- Draw `bitmap' at the `x', `y' position
-- using `a_width' and `a_height'.
require
exists: exists
a_bitmap_not_void: a_bitmap /= void
a_bitmap_exists: a_bitmap.exists

draw_icon (icon: WEL_ICON; x, y: INTEGER)
-- Draw `icon' at the `x', `y' position.
require
exists: exists
icon_not_void: icon /= void
icon_exists: icon.exists

draw_cursor (cursor: WEL_CURSOR; x, y: INTEGER)
-- Draw `cursor' at the `x', `y' position.
require
exists: exists
cursor_not_void: cursor /= void
cursor_exists: cursor.exists

set_pixel (x, y: INTEGER; color: WEL_COLOR_REF)
-- Set the pixel at `x', `y' position
-- with the `color' color.
require
exists: exists
color_not_void: color /= void

line (x1, y1, x2, y2: INTEGER)
-- Draw a line from `x1', `y1' to `x2', `y2'
require
exists: exists

polyline (points: ARRAY [INTEGER])
-- Draws a series of line segments by connecting the
-- points specified in `points'.
require
exists: exists
points_not_void: points /= void
points_count: points.count \\ 2 = 0

line_to (x, y: INTEGER)
-- Draw a line from the current position
-- to `x', `y' position
require
exists: exists

move_to (x, y: INTEGER)
-- Set the current position to `x', `y' position
require
exists: exists

rectangle (left, top, right, bottom: INTEGER)
-- Draw a rectangle from `left', `top'
-- to `right', `bottom'.
require
exists: exists

fill_rect (a_rect: WEL_RECT; a_brush: WEL_BRUSH)
-- Fill a `a_rect' by using `a_brush' to fill it.
require
exists: exists
a_rect_not_void: a_rect /= void
a_brush_not_void: a_brush /= void
a_brush_exists: a_brush.exists

invert_rect (a_rect: WEL_RECT)
-- Invert `a_rect' in a window by performing a logical
-- NOT operation on the color values for each pixel.
require
exists: exists
a_rect_not_void: a_rect /= void

invert_region (a_region: WEL_REGION)
-- Invert the colors in `a_region'.
require
exists: exists
a_region_not_void: a_region /= void
a_region_exists: a_region.exists

flood_fill_border (x, y: INTEGER; color: WEL_COLOR_REF)
-- Fill an area which is bounded by `color' starting
-- at `x', `y'.
require
exists: exists
color_not_void: color /= void

flood_fill_surface (x, y: INTEGER; color: WEL_COLOR_REF)
-- Fill an area which is defined by `color' starting
-- at `x', `y'. Filling continues outward in all
-- directions as long as the color is encountered.
require
exists: exists
color_not_void: color /= void

polygon (points: ARRAY [INTEGER])
-- Draw a polygon consisting of two or more `points'
-- connected by lines.
require
exists: exists
points_not_void: points /= void
points_count: points.count \\ 2 = 0

ellipse (left, top, right, bottom: INTEGER)
-- Draw an ellipse into a rectangle specified by
-- `left', `top' and `right', `bottom'
require
exists: exists

arc (left, top, right, bottom, x_start_arc, y_start_arc, x_end_arc, y_end_arc: INTEGER)
-- Draw an elliptical arc into a rectangle specified
-- by `left', `top' and `right', `bottom', starting
-- at `x_start_arc', `y_start_arc' and ending at
-- `x_end_arc', `y_end_arc'
require
exists: exists

chord (left, top, right, bottom, x_start_line, y_start_line, x_end_line, y_end_line: INTEGER)
-- Draw a chord into a rectangle specified
-- by `left', `top' and `right', `bottom', starting
-- at `x_start_line', `y_start_line' and ending at
-- `x_end_line', `y_end_line'
require
exists: exists

pie (left, top, right, bottom, x_start_point, y_start_point, x_end_point, y_end_point: INTEGER)
-- Draw a pie-shaped wedge by drawing an elliptical
-- arc whose center and two endpoints are joined
-- by lines. The pie is drawn into a rectangle
-- specified by `left', `top' and `right', `bottom',
-- starting at `x_start_point', `y_start_point'
-- and ending at `x_end_point', `y_end_point'
require
exists: exists

round_rect (left, top, right, bottom, ellipse_width, ellipse_height: INTEGER)
-- Draw a rectangle from `left', `top' to
-- `right', `bottom' with rounded corners.
-- The rounded corners are specified by the
-- `ellipse_width' and `ellipse_height'
require
exists: exists

copy_dc (dc_source: WEL_DC; rect: WEL_RECT)
-- Copy the content of `rect' in `dc_source'
-- to the current dc.
require
exists: exists
rect_not_void: rect /= void
dc_source_not_void: dc_source /= void
dc_source_exists: dc_source.exists

bit_blt (x_destination, y_destination, a_width, a_height: INTEGER; dc_source: WEL_DC; x_source, y_source, raster_operation: INTEGER)
-- Copy a bitmap from the `dc_source' to
-- the current device context, from `x_source',
-- `y_source' to `x_destination', `y_destination',
-- using `a_width' and `a_height' with `raster_operation'.
-- See class WEL_RASTER_OPERATIONS_CONSTANTS for
-- `raster_operation' values.
require
exists: exists
positive_width: a_width >= 0
positive_height: a_height >= 0
dc_source_not_void: dc_source /= void
dc_source_exists: dc_source.exists

stretch_blt (x_destination, y_destination, width_destination, height_destination: INTEGER; dc_source: WEL_DC; x_source, y_source, width_source, height_source, raster_operation: INTEGER)
-- Copy a bitmap from the `dc_source' to
-- the current device context, from `x_source',
-- `y_source' to `x_destination', `y_destination',
-- using `width' and `height' with `raster_operation'.
-- See class WEL_RASTER_OPERATIONS_CONSTANTS for
-- `raster_operation' values.
require
exists: exists
positive_width_destination: width_destination >= 0
positive_height_destination: height_destination >= 0
positive_width_source: width_source >= 0
positive_height_source: height_source >= 0
dc_source_not_void: dc_source /= void
dc_source_exists: dc_source.exists

stretch_di_bits (x_destination, y_destination, a_width, a_height, x_source, y_source, dib_width, dib_height: INTEGER; dib: WEL_DIB; bitmap_info: WEL_BITMAP_INFO; rgb_mode, raster_operation: INTEGER)
-- Copy a dib to the current device context, from
-- `x_source', `y_source' to `x_destination',
-- `y_destination', using `a_width' and `a_height'
-- with `raster_operation' and `rgb_mode'
-- See class WEL_RASTER_OPERATIONS_CONSTANTS for
-- `raster_operation' values
-- See class WEL_DIB_COLORS_CONSTANTS for
-- `rgb_mode' values
require
exists: exists
positive_width: a_width >= 0
positive_height: a_height >= 0
dib_not_void: dib /= void
bitmap_not_void: bitmap_info /= void
valid_rgb_mode: valid_dib_colors_constant (rgb_mode)

pat_blt (x_destination, y_destination, a_width, a_height: INTEGER; raster_operation: INTEGER)
-- Copy a bitmap from the `dc_source' to
-- `y_source' to `x_destination', `y_destination',
-- using with `raster_operation'.
-- See class WEL_RASTER_OPERATIONS_CONSTANTS for
-- `raster_operation' values.
require
exists: exists
positive_width: a_width >= 0
positive_height: a_height >= 0

save_bitmap (a_bitmap: WEL_BITMAP; file: FILE_NAME)
-- Save `a_bitmap' in `file'.
require
exists: exists
a_bitmap_not_void: a_bitmap /= void
a_bitmap_exists: a_bitmap.exists
file_not_void: file /= void
file_is_valid: file.is_valid

di_bits (a_bitmap: WEL_BITMAP; start_scan, scan_lines: INTEGER; bitmap_info: WEL_BITMAP_INFO; usage: INTEGER): ARRAY [CHARACTER]
-- Device-independent bits of `a_bitmap'.
-- `start_scan' specifies the first scan line to
-- retrieve and `scan_lines' specifies the number of
-- scan lines to retrieve. `bitmap_info' specifies the
-- desired format for the dib data.
require
exists: exists
a_bitmap_not_void: a_bitmap /= void
a_bitmap_exists: a_bitmap.exists
positive_start_scan: start_scan >= 0
positive_scan_lines: scan_lines >= 0
bitmap_info_not_void: bitmap_info /= void
valid_usage: valid_dib_colors_constant (usage)
ensure
result_not_void: Result /= void
consistent_count: Result.count = bitmap_info.header.size_image

poly_bezier (points: ARRAY [INTEGER])
-- Draw one or more Bezier curves by using the
-- endpoints and control points specified by `points'.
-- The first curve is drawn from the first point to the
-- fourth point by using the second and third points as
-- control points. Each subsequent curve in the sequence
-- needs exactly three more points: the ending point of
-- the previous curve is used as the starting point, the
-- next two points in the sequence are control points,
-- and the third is the ending point.
-- The current position is neither used nor updated by
-- this procedure.
require
points_not_void: points /= void
points_count_ok: points.count \\ 2 = 0

poly_bezier_to (points: ARRAY [INTEGER])
-- Draw one or more Bezier curves by using the control
-- points specified by `points'. The first curve is
-- drawn from the current position to the third point
-- by using the first two points as control points.
-- For each subsequent curve, the procedure needs
-- exactly three more points, and uses the ending point
-- of the previous curve as the starting point for the
-- next.
-- This procedure moves the current position to the
-- ending point of the last Bezier curve.
require
points_not_void: points /= void
points_count_ok: points.count \\ 2 = 0
feature -- Removal

delete
-- Delete the current device context.
require
exists: exists
ensure
not_exists: not exists
feature -- Obsolete

set_bk_color (color: WEL_COLOR_REF)
obsolete "Use ``set_background_color''"

poly_line (points: ARRAY [INTEGER])
obsolete "Use ``polyline''"

save (a_bitmap: WEL_BITMAP; file: FILE_NAME)
obsolete "Use ``save_bitmap''"
invariant

valid_background_mode: exists implies is_opaque /= is_transparent
end -- class WEL_DC

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES