|
|
|
abstract ['ImagePrototype' is defining the API to deal with pixels
|
|
abstract ['ImagePrototype' is defining the API to deal with pixels
|
|
|
|
|
|
|
method p clip x0 y0 x1 y1 oarg ImagePrototype p ; arg_rw Int x0 y0 x1 y1 generic x0 := max x0 0 y0 := max y0 0 x1 := min x1 p:size_x y1 := min y1 p:size_y
|
|
method p clip x0 y0 x1 y1 oarg ImagePrototype p ; arg_rw Int x0 y0 x1 y1 generic x0 := max x0 0 y0 := max y0 0 x1 := min x1 p:size_x y1 := min y1 p:size_y
|
|
|
|
|
|
|
method p rectangle_read_map x y x0 y0 x1 y1 step_x step_y -> oarg_rw ImagePrototype p ; arg Int x y ; arg_w Int x0 y0 x generic adr := p read_map x y 1 p:size_x-x (var Int count) if adr<>null x0 := x ; y0 := y ; x1 := x+count ; y1 := y+1 step_x := p pixel_size ; step_y := undefined
|
|
method p rectangle_read_map x y x0 y0 x1 y1 step_x step_y -> oarg_rw ImagePrototype p ; arg Int x y ; arg_w Int x0 y0 x generic adr := p read_map x y 1 p:size_x-x (var Int count) if adr<>null x0 := x ; y0 := y ; x1 := x+count ; y1 := y+1 step_x := p pixel_size ; step_y := undefined
|
|
|
|
|
|
method p query command -> answer oarg_rw ImagePrototype p ; arg Str command answer generic answer := ""
method p configure command -> status oarg_rw ImagePrototype p ; arg Str command ; arg ExtendedStatus status generic status := failure "unkown command"
|
|
method p line_size -> ls arg ImagePrototype p ; arg Int ls ls := p:pixel_size*p:size_x
function image_prototype p options -> p2 arg ImagePrototype p p2 ; arg Str options var Float margin := options option "margin" Float 0 var Float x0 := options option "x0" Float p:x0-margin var Float y0 := options option "y0" Float p:y0-margin var Float x1 := options option "x1" Float p:x1+margin var Float y1 := options option "y1" Float p:y1+margin if not ((options (options option_position "resolution" 0) dpi_x := options option "resolution" Float undefined ; d if dpi_x=undefined and p:size_x<>undefined dpi_x := p:size_x/(abs p:x1-p:x0)*25.4 if dpi_y=undefined and p:size_y<>undefined dpi_y := p:size_y/(abs p:y1-p:y0)*25.4 var Int size_x := options option "size_x" Int var Int size_y := options option "size_y" Int var Link:ColorGamut g :> p gamut if g:transparency>0 and (options option "drop_transparency var Link:ColorGamut g2 :> color_gamut (replace g:name "+ if g2=success g :> g2 if size_x=defined or size_y=defined or dpi_x=undefined or p2 := image_prototype x0 y0 x1 y1 size_x size_y g else if not ((options (options option_position "antialiasing" aa_x := options option "antialiasing" Int 1 ; aa_y := p2 := image_prototype x0 y0 x1 y1 dpi_x dpi_y aa_x aa_y
|
|
method p line_size -> ls arg ImagePrototype p ; arg Int ls ls := p:pixel_size*p:size_x
function image_prototype p options -> p2 arg ImagePrototype p p2 ; arg Str options var Float margin := options option "margin" Float 0 var Float x0 := options option "x0" Float p:x0-margin var Float y0 := options option "y0" Float p:y0-margin var Float x1 := options option "x1" Float p:x1+margin var Float y1 := options option "y1" Float p:y1+margin if not ((options (options option_position "resolution" 0) dpi_x := options option "resolution" Float undefined ; d if dpi_x=undefined and p:size_x<>undefined dpi_x := p:size_x/(abs p:x1-p:x0)*25.4 if dpi_y=undefined and p:size_y<>undefined dpi_y := p:size_y/(abs p:y1-p:y0)*25.4 var Int size_x := options option "size_x" Int var Int size_y := options option "size_y" Int var Link:ColorGamut g :> p gamut if g:transparency>0 and (options option "drop_transparency var Link:ColorGamut g2 :> color_gamut (replace g:name "+ if g2=success g :> g2 if size_x=defined or size_y=defined or dpi_x=undefined or p2 := image_prototype x0 y0 x1 y1 size_x size_y g else if not ((options (options option_position "antialiasing" aa_x := options option "antialiasing" Int 1 ; aa_y := p2 := image_prototype x0 y0 x1 y1 dpi_x dpi_y aa_x aa_y
|