cd_client_images.e 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. deferred class CD_CLIENT_IMAGES
  2. -- There are 2 kinds of client images: RGB and Indexed RGB (or MAP). The RGB
  3. -- image is composed by 3 buffers: red, green and blue (more colors, more
  4. -- memory). The MAP image is composed by 1 buffer of indices for a table and
  5. -- one table of encoded RGB values (less colors, less memory).
  6. --
  7. -- The image buffer is described by its width and height in pixels. The
  8. -- starting point of the buffer is the origin of the image, which is located at
  9. -- its bottom left corner. To retrieve a pixel in the image, use the formula
  10. -- pixel(x,y)=buffer[y*width + x].
  11. --
  12. -- The Put functions may do zoom in or out; zero order interpolation is used to
  13. -- scale the image. It is not possible to specify a part of the image to be
  14. -- drawn.
  15. inherit
  16. CANVAS_DRAW
  17. feature {ANY}
  18. get_image_rgb (x, y, width, height: INTEGER): detachable TUPLE[ARRAY[INTEGER_8], ARRAY[INTEGER_8], ARRAY[INTEGER_8]]
  19. -- Returns the red, green and blue components of each pixel in a server
  20. -- image. The RGB components are provided in three arrays. The (i,j)
  21. -- component of these matrices is at the address (j*w+i). As occurs with
  22. -- all primitives from the Canvas Draw library, the pixel (0,0) is at the
  23. -- bottom left corner, and the pixel (w-1,h-1) is that the upper right
  24. -- corner of the image rectangle.
  25. local
  26. p1, p2, p3: POINTER
  27. do
  28. int_canvas_get_image_rgb(cnvs, p1, p2, p3, x, y, width, height)
  29. Result := [convert_to_array(p1, width, height),
  30. convert_to_array(p2, width, height),
  31. convert_to_array(p3, width, height)]
  32. end
  33. get_wd_image_rgb (x, y: REAL_64; width, height: INTEGER): TUPLE[ARRAY[INTEGER_8], ARRAY[INTEGER_8], ARRAY[INTEGER_8]]
  34. -- Like "get_image_rgb" but using world coordinates (REAL_64 values).
  35. local
  36. p1, p2, p3: POINTER
  37. do
  38. int_wd_canvas_get_image_rgb(cnvs, p1, p2, p3, x, y, width, height)
  39. Result := [convert_to_array(p1, width, height),
  40. convert_to_array(p2, width, height),
  41. convert_to_array(p3, width, height)]
  42. end
  43. put_image_rect_rgb (image_width, image_height: INTEGER; colors: TUPLE[ARRAY[INTEGER_8], ARRAY[INTEGER_8], ARRAY[INTEGER_8]]; x, y, w, h, xmin, xmax, ymin, ymax: INTEGER)
  44. -- Puts, in a specified area of the canvas, an image with its red, green
  45. -- and blue components defined in the three matrices stored in byte
  46. -- arrays. The (i,j) component of these matrices is at the address
  47. -- (j*iw+i). The pixel (0,0) is at the bottom left corner, and the pixel
  48. -- (iw-1,ih-1) is that the upper right corner of the image rectangle.
  49. --
  50. -- Parameters w and h refer to the target rectangle of the canvas, so
  51. -- that it is possible to reduce or expand the image drawn. If w and h
  52. -- are 0, the size of the image is assumed (iw and ih).
  53. --
  54. -- It also allows specifying a rectangle inside the image to be drawn, if
  55. -- xmin, xmax, ymin and ymax are 0 then the whole image is assumed.
  56. --
  57. -- If the driver has bpp <=8 or only 256 colors or less, then the image
  58. -- is converted to 256 optimal colors using the function "rgb_to_map" and
  59. -- is drawn using "put_image_rect_map".
  60. do
  61. if attached {ARRAY[INTEGER_8]} colors.item(1) as r and
  62. attached {ARRAY[INTEGER_8]} colors.item(2) as g and
  63. attached {ARRAY[INTEGER_8]} colors.item(3) as b then
  64. int_canvas_put_image_rgb(cnvs, image_width, image_height,
  65. convert_to_character_array(r, image_width, image_height),
  66. convert_to_character_array(g, image_width, image_height),
  67. convert_to_character_array(b, image_width, image_height),
  68. x, y, w, h, xmin, xmax, ymin, ymax)
  69. end
  70. end
  71. put_image_rect_rgb_real (image_width, image_height: INTEGER; colors: TUPLE[ARRAY[INTEGER_8], ARRAY[INTEGER_8], ARRAY[INTEGER_8]]; x, y, w, h: REAL_64; xmin, xmax, ymin, ymax: INTEGER)
  72. -- Like "put_image_rect_rgb" but using REAL_64 values.
  73. do
  74. if attached {ARRAY[INTEGER_8]} colors.item(1) as r and
  75. attached {ARRAY[INTEGER_8]} colors.item(2) as g and
  76. attached {ARRAY[INTEGER_8]} colors.item(3) as b then
  77. int_canvas_c_double_put_image_rgb(cnvs, image_width, image_height,
  78. convert_to_character_array(r, image_width, image_height),
  79. convert_to_character_array(g, image_width, image_height),
  80. convert_to_character_array(b, image_width, image_height),
  81. x, y, w, h, xmin, xmax, ymin, ymax)
  82. end
  83. end
  84. put_wd_image_rect_rgb (image_width, image_height: INTEGER; colors: TUPLE[ARRAY[INTEGER_8], ARRAY[INTEGER_8], ARRAY[INTEGER_8]]; x, y, w, h: REAL_64; xmin, xmax, ymin, ymax: INTEGER)
  85. -- Like "put_image_rect_rgb" but using world coordinates (REAL_64 values).
  86. do
  87. if attached {ARRAY[INTEGER_8]} colors.item(1) as r and
  88. attached {ARRAY[INTEGER_8]} colors.item(2) as g and
  89. attached {ARRAY[INTEGER_8]} colors.item(3) as b then
  90. int_wd_canvas_put_image_rgb(cnvs, image_width, image_height,
  91. convert_to_character_array(r, image_width, image_height),
  92. convert_to_character_array(g, image_width, image_height),
  93. convert_to_character_array(b, image_width, image_height),
  94. x, y, w, h, xmin, xmax, ymin, ymax)
  95. end
  96. end
  97. put_image_rect_rgba (image_width, image_height: INTEGER; colors: TUPLE[ARRAY[INTEGER_8], ARRAY[INTEGER_8], ARRAY[INTEGER_8], ARRAY[INTEGER_8]]; x, y, w, h, xmin, xmax, ymin, ymax: INTEGER)
  98. -- The same as function "put_image_rect_rgb", except for the fact that it
  99. -- is possible to specify an alpha channel. The resulting color is the
  100. -- image color weighted by the alpha value, using the formula
  101. -- result=(source * alpha + destiny * (255 - alpha))/255. This means
  102. -- that, if alpha is 0, the resulting color is the target color
  103. -- (completely transparent), and, if alpha is 255, the resulting color is
  104. -- the original image color (completely opaque).
  105. --
  106. -- If this function is not defined for a given driver or if alpha is
  107. -- Void, then the function "put_image_rect_rgb" is used, as long as it is
  108. -- defined.
  109. do
  110. if attached {ARRAY[INTEGER_8]} colors.item(1) as r and
  111. attached {ARRAY[INTEGER_8]} colors.item(2) as g and
  112. attached {ARRAY[INTEGER_8]} colors.item(3) as b and
  113. attached {ARRAY[INTEGER_8]} colors.item(4) as a then
  114. int_canvas_put_image_rgba(cnvs, image_width, image_height,
  115. convert_to_character_array(r, image_width, image_height),
  116. convert_to_character_array(g, image_width, image_height),
  117. convert_to_character_array(b, image_width, image_height),
  118. convert_to_character_array(a, image_width, image_height),
  119. x, y, w, h, xmin, xmax, ymin, ymax)
  120. end
  121. end
  122. put_image_rect_rgba_real (image_width, image_height: INTEGER; colors: TUPLE[ARRAY[INTEGER_8], ARRAY[INTEGER_8], ARRAY[INTEGER_8], ARRAY[INTEGER_8]]; x, y, w, h: REAL_64; xmin, xmax, ymin, ymax: INTEGER)
  123. -- Like "put_image_rect_rgb" but using REAL_64 values.
  124. do
  125. if attached {ARRAY[INTEGER_8]} colors.item(1) as r and
  126. attached {ARRAY[INTEGER_8]} colors.item(2) as g and
  127. attached {ARRAY[INTEGER_8]} colors.item(3) as b and
  128. attached {ARRAY[INTEGER_8]} colors.item(4) as a then
  129. int_canvas_c_double_put_image_rgba(cnvs, image_width, image_height,
  130. convert_to_character_array(r, image_width, image_height),
  131. convert_to_character_array(g, image_width, image_height),
  132. convert_to_character_array(b, image_width, image_height),
  133. convert_to_character_array(a, image_width, image_height),
  134. x, y, w, h, xmin, xmax, ymin, ymax)
  135. end
  136. end
  137. put_wd_image_rect_rgba (image_width, image_height: INTEGER; colors: TUPLE[ARRAY[INTEGER_8], ARRAY[INTEGER_8], ARRAY[INTEGER_8], ARRAY[INTEGER_8]]; x, y, w, h: REAL_64; xmin, xmax, ymin, ymax: INTEGER)
  138. -- Like "put_image_rect_rgb" but using world coordinates (REAL_64 values).
  139. do
  140. if attached {ARRAY[INTEGER_8]} colors.item(1) as r and
  141. attached {ARRAY[INTEGER_8]} colors.item(2) as g and
  142. attached {ARRAY[INTEGER_8]} colors.item(3) as b and
  143. attached {ARRAY[INTEGER_8]} colors.item(4) as a then
  144. int_wd_canvas_put_image_rgba(cnvs, image_width, image_height,
  145. convert_to_character_array(r, image_width, image_height),
  146. convert_to_character_array(g, image_width, image_height),
  147. convert_to_character_array(b, image_width, image_height),
  148. convert_to_character_array(a, image_width, image_height),
  149. x, y, w, h, xmin, xmax, ymin, ymax)
  150. end
  151. end
  152. put_image_rect_map (image_width, image_height: INTEGER; index: ARRAY[INTEGER_8]; colors: ARRAY[INTEGER_8]; x, y, w, h, xmin, xmax, ymin, ymax: INTEGER)
  153. -- The same as function "put_image_rect_rgb", except for the fact that
  154. -- the colors are provided by means of an index matrix (map). The color
  155. -- corresponding to a given index is given in colors[index]. The map is
  156. -- also a matrix stored as a byte vector. If the color vector is Void,
  157. -- then a vector with 256 gray tones is assumed.
  158. do
  159. int_canvas_put_image_map(cnvs, image_width, image_height,
  160. convert_to_character_array(index, image_width, image_height),
  161. convert_to_integer_array(colors, image_width, image_height),
  162. x, y, w, h, xmin, xmax, ymin, ymax)
  163. end
  164. put_image_rect_map_real (image_width, image_height: INTEGER; index: ARRAY[INTEGER_8]; colors: ARRAY[INTEGER_8]; x, y, w, h: REAL_64; xmin, xmax, ymin, ymax: INTEGER)
  165. -- Like "put_image_rect_map" but using REAL_64 values.
  166. do
  167. int_canvas_c_double_put_image_map(cnvs, image_width, image_height,
  168. convert_to_character_array(index, image_width, image_height),
  169. convert_to_integer_array(colors, image_width, image_height),
  170. x, y, w, h, xmin, xmax, ymin, ymax)
  171. end
  172. put_wd_image_rect_map (image_width, image_height: INTEGER; index: ARRAY[INTEGER_8]; colors: ARRAY[INTEGER_8]; x, y, w, h: REAL_64; xmin, xmax, ymin, ymax: INTEGER)
  173. -- Like "put_image_rect_map" but using world coordinates (REAL_64 values).
  174. do
  175. int_wd_canvas_put_image_map(cnvs, image_width, image_height,
  176. convert_to_character_array(index, image_width, image_height),
  177. convert_to_integer_array(colors, image_width, image_height),
  178. x, y, w, h, xmin, xmax, ymin, ymax)
  179. end
  180. -- Skeep for the moment the imimage features. Instead add
  181. -- IUP_IMAGE features.
  182. get_iup_image (x, y, width, height: INTEGER): IUP_IMAGE
  183. -- The same as the "get_image_rgb" functions except for the fact that use
  184. -- an IUP_IMAGE object.
  185. local
  186. imimg, iupimg: POINTER
  187. image: IUP_IMAGE
  188. do
  189. imimg := int_im_image_create (width, height, 0, 0)
  190. int_canvas_get_im_image(cnvs, imimg, x, y)
  191. iupimg := int_iup_image_from_im_image(imimg)
  192. create image.with_internal(iupimg)
  193. int_im_image_destroy(iupimg)
  194. Result := image
  195. end
  196. get_wd_iup_image (x, y: REAL_64; width, height: INTEGER): IUP_IMAGE
  197. -- The same as "get_iup_image" but with World Coordinates.
  198. local
  199. imimg, iupimg: POINTER
  200. image: IUP_IMAGE
  201. do
  202. imimg := int_im_image_create (width, height, 0, 0)
  203. int_wd_canvas_get_im_image(cnvs, imimg, x, y)
  204. iupimg := int_iup_image_from_im_image(imimg)
  205. create image.with_internal(iupimg)
  206. int_im_image_destroy(iupimg)
  207. Result := image
  208. end
  209. put_iup_image (image: IUP_IMAGE; x, y: INTEGER)
  210. -- The same as the above functions except for the fact that use an
  211. -- IUP_IMAGE object. Image must be a displayable image and it can has an
  212. -- alpha channel.
  213. local
  214. p, img: POINTER
  215. do
  216. p := image.get_wid.deep_twin
  217. img := int_get_native_handle_image(p)
  218. int_canvas_put_im_image(cnvs, img, x, y,
  219. image.get_width,
  220. image.get_height)
  221. end
  222. put_iup_image_real (image: IUP_IMAGE; x, y: REAL_64)
  223. -- Like "put_iup_image" but using REAL_64 values.
  224. local
  225. p, img: POINTER
  226. do
  227. p := image.get_wid.deep_twin
  228. img := int_get_native_handle_image(p)
  229. int_canvas_c_double_put_im_image(cnvs, img, x, y,
  230. image.get_width.to_double,
  231. image.get_height.to_double)
  232. end
  233. put_wd_iup_image (image: IUP_IMAGE; x, y: REAL_64)
  234. -- Like "put_iup_image" but using World Coordinates.
  235. local
  236. p, img: POINTER
  237. do
  238. p := image.get_wid.deep_twin
  239. img := int_get_native_handle_image(p)
  240. int_wd_canvas_put_im_image(cnvs, img, x, y,
  241. image.get_width.to_double,
  242. image.get_height.to_double)
  243. end
  244. rgb_to_map (image_width, image_height: INTEGER; rgb_arrays: TUPLE[ARRAY[INTEGER_8], ARRAY[INTEGER_8], ARRAY[INTEGER_8]]; palette_size: INTEGER): detachable TUPLE[ARRAY[INTEGER_8], ARRAY[INTEGER_8]]
  245. -- Converts an RGB image into an image with 256 indexed colors. The
  246. -- resulting image must have the same size (width x height) as the RGB
  247. -- image.
  248. local
  249. index, colors: POINTER
  250. do
  251. if attached {ARRAY[INTEGER_8]} rgb_arrays.item(1) as r and
  252. attached {ARRAY[INTEGER_8]} rgb_arrays.item(2) as g and
  253. attached {ARRAY[INTEGER_8]} rgb_arrays.item(3) as b then
  254. int_rgb_to_map(image_width, image_height, convert_to_integer_array(r, image_width, image_height),
  255. convert_to_integer_array(g, image_width, image_height),
  256. convert_to_integer_array(b, image_width, image_height), index, palette_size, colors)
  257. Result := [convert_to_array(index, image_width, image_height),
  258. convert_to_array(colors, 1, palette_size)]
  259. end
  260. end
  261. feature {NONE}
  262. -- Converts
  263. convert_to_array (p: POINTER; w, h: INTEGER): ARRAY[INTEGER_8]
  264. local
  265. i, size: INTEGER
  266. m: MANAGED_POINTER
  267. a: ARRAY[INTEGER_8]
  268. do
  269. if p /= default_pointer then
  270. size := w*h
  271. create m.make_from_pointer(p, size)
  272. create a.make_filled((0).to_integer_8, 1, size)
  273. from
  274. i := 0
  275. until
  276. i = size
  277. loop
  278. a.put(m.read_integer_8(i), i)
  279. i := i + 1
  280. end
  281. Result := a
  282. else
  283. io.put_string("Something goes wrong %N")
  284. create Result.make_empty
  285. end
  286. end
  287. convert_to_character_array (p: ARRAY[INTEGER_8]; w, h: INTEGER): POINTER
  288. local
  289. i, size: INTEGER
  290. m: ARRAY[CHARACTER_8]
  291. do
  292. size := w*h
  293. create m.make_filled(' ', 1, size + 1)
  294. from
  295. i := 0
  296. until
  297. i = size
  298. loop
  299. m.put(p.item(i).to_character_8, i)
  300. i := i + 1
  301. end
  302. Result := get_pointer(m.to_c)
  303. end
  304. convert_to_integer_array (p: ARRAY[INTEGER_8]; w, h: INTEGER): POINTER
  305. -- Revise GOBO
  306. local
  307. a: ARRAY[INTEGER_8]
  308. do
  309. create a.make_from_array(p)
  310. a.grow(1)
  311. Result := get_pointer(a.to_c)
  312. end
  313. -- Internals
  314. int_canvas_get_image_rgb(wgt, r, g, b: POINTER; x, y, iw, ih: INTEGER)
  315. external
  316. "C inline use %"eiffel-iup.h%""
  317. alias
  318. "cdCanvasGetImageRGB ($wgt, $r, $g, $b, $x, $y, $iw, $ih);"
  319. end
  320. int_wd_canvas_get_image_rgb(wgt, r, g, b: POINTER; x, y: REAL_64; iw, ih: INTEGER)
  321. external
  322. "C inline use %"eiffel-iup.h%""
  323. alias
  324. "wdCanvasGetImageRGB ($wgt, $r, $g, $b, $x, $y, $iw, $ih);"
  325. end
  326. int_canvas_put_image_rgb(wgt: POINTER; iw, ih: INTEGER; r, g, b: POINTER; x, y, w, h, xmin, xmax, ymin, ymax: INTEGER)
  327. external
  328. "C inline use %"eiffel-iup.h%""
  329. alias
  330. "cdCanvasPutImageRectRGB ($wgt, $iw, $ih, $r, $g, $b, $x, $y, $w, $h, $xmin, $xmax, $ymin, $ymax);"
  331. end
  332. int_canvas_c_double_put_image_rgb(wgt: POINTER; iw, ih: INTEGER; r, g, b: POINTER; x, y, w, h: REAL_64; xmin, xmax, ymin, ymax: INTEGER)
  333. external
  334. "C inline use %"eiffel-iup.h%""
  335. alias
  336. "cdfCanvasPutImageRectRGB ($wgt, $iw, $ih, $r, $g, $b, $x, $y, $w, $h, $xmin, $xmax, $ymin, $ymax);"
  337. end
  338. int_wd_canvas_put_image_rgb(wgt: POINTER; iw, ih: INTEGER; r, g, b: POINTER; x, y, w, h: REAL_64; xmin, xmax, ymin, ymax: INTEGER)
  339. external
  340. "C inline use %"eiffel-iup.h%""
  341. alias
  342. "wdCanvasPutImageRectRGB ($wgt, $iw, $ih, $r, $g, $b, $x, $y, $w, $h, $xmin, $xmax, $ymin, $ymax);"
  343. end
  344. int_canvas_put_image_rgba(wgt: POINTER; iw, ih: INTEGER; r, g, b, a: POINTER; x, y, w, h, xmin, xmax, ymin, ymax: INTEGER)
  345. external
  346. "C inline use %"eiffel-iup.h%""
  347. alias
  348. "cdCanvasPutImageRectRGBA ($wgt, $iw, $ih, $r, $g, $b, $a, $x, $y, $w, $h, $xmin, $xmax, $ymin, $ymax);"
  349. end
  350. int_canvas_c_double_put_image_rgba(wgt: POINTER; iw, ih: INTEGER; r, g, b, a: POINTER; x, y, w, h: REAL_64; xmin, xmax, ymin, ymax: INTEGER)
  351. external
  352. "C inline use %"eiffel-iup.h%""
  353. alias
  354. "cdfCanvasPutImageRectRGBA ($wgt, $iw, $ih, $r, $g, $b, $a, $x, $y, $w, $h, $xmin, $xmax, $ymin, $ymax);"
  355. end
  356. int_wd_canvas_put_image_rgba(wgt: POINTER; iw, ih: INTEGER; r, g, b, a: POINTER; x, y, w, h: REAL_64; xmin, xmax, ymin, ymax: INTEGER)
  357. external
  358. "C inline use %"eiffel-iup.h%""
  359. alias
  360. "wdCanvasPutImageRectRGBA ($wgt, $iw, $ih, $r, $g, $b, $a, $x, $y, $w, $h, $xmin, $xmax, $ymin, $ymax);"
  361. end
  362. int_canvas_put_image_map(wgt: POINTER; iw, ih: INTEGER; i, c: POINTER; x, y, w, h, xmin, xmax, ymin, ymax: INTEGER)
  363. external
  364. "C inline use %"eiffel-iup.h%""
  365. alias
  366. "cdCanvasPutImageRectMap ($wgt, $iw, $ih, $i, $c, $x, $y, $w, $h, $xmin, $xmax, $ymin, $ymax);"
  367. end
  368. int_canvas_c_double_put_image_map(wgt: POINTER; iw, ih: INTEGER; i, c: POINTER; x, y, w, h: REAL_64; xmin, xmax, ymin, ymax: INTEGER)
  369. external
  370. "C inline use %"eiffel-iup.h%""
  371. alias
  372. "cdfCanvasPutImageRectMap ($wgt, $iw, $ih, $i, $c, $x, $y, $w, $h, $xmin, $xmax, $ymin, $ymax);"
  373. end
  374. int_wd_canvas_put_image_map(wgt: POINTER; iw, ih: INTEGER; i, c: POINTER; x, y, w, h: REAL_64; xmin, xmax, ymin, ymax: INTEGER)
  375. external
  376. "C inline use %"eiffel-iup.h%""
  377. alias
  378. "wdCanvasPutImageRectMap ($wgt, $iw, $ih, $i, $c, $x, $y, $w, $h, $xmin, $xmax, $ymin, $ymax);"
  379. end
  380. int_canvas_get_im_image(wgt, img: POINTER; x, y: INTEGER)
  381. external
  382. "C inline use %"eiffel-iup.h%""
  383. alias
  384. "cdCanvasGetImImage ($wgt, $img, $x, $y);"
  385. end
  386. int_wd_canvas_get_im_image(wgt, img: POINTER; x, y: REAL_64)
  387. external
  388. "C inline use %"eiffel-iup.h%""
  389. alias
  390. "wdCanvasGetImImage ($wgt, $img, $x, $y);"
  391. end
  392. int_canvas_put_im_image(wgt, img: POINTER; x, y, w, h: INTEGER)
  393. external
  394. "C inline use %"eiffel-iup.h%""
  395. alias
  396. "cdCanvasPutImImage ($wgt, $img, $x, $y, $w, $h);"
  397. end
  398. int_canvas_c_double_put_im_image(wgt, img: POINTER; x, y, w, h: REAL_64)
  399. external
  400. "C inline use %"eiffel-iup.h%""
  401. alias
  402. "cdfCanvasPutImImage ($wgt, $img, $x, $y, $w, $h);"
  403. end
  404. int_wd_canvas_put_im_image(wgt, img: POINTER; x, y, w, h: REAL_64)
  405. external
  406. "C inline use %"eiffel-iup.h%""
  407. alias
  408. "wdCanvasPutImImage ($wgt, $img, $x, $y, $w, $h);"
  409. end
  410. int_rgb_to_map(iw, ih: INTEGER; r, g, b, i: POINTER; ps: INTEGER; cl: POINTER)
  411. external
  412. "C inline use %"eiffel-iup.h%""
  413. alias
  414. "cdRGB2Map ($iw, $ih, $r, $g, $b, $i, $ps, $cl);"
  415. end
  416. int_get_native_handle_image(wgt: POINTER): POINTER
  417. external
  418. "C inline use %"eiffel-iup.h%""
  419. alias
  420. "return IupGetNativeHandleImage ($wgt);"
  421. end
  422. int_iup_image_from_im_image(wgt: POINTER): POINTER
  423. external
  424. "C inline use %"eiffel-iup.h%""
  425. alias
  426. "return IupImageFromImImage ($wgt);"
  427. end
  428. -- These features maybe should be removed in the future.
  429. int_im_image_create(w, h, cs, dt: INTEGER): POINTER
  430. external
  431. "C inline use %"eiffel-iup.h%""
  432. alias
  433. "return imImageCreate ($w, $h, $cs, $dt);"
  434. end
  435. int_im_image_destroy(wgt: POINTER)
  436. external
  437. "C inline use %"eiffel-iup.h%""
  438. alias
  439. "imImageDestroy ($wgt);"
  440. end
  441. end
  442. -- The MIT License (MIT)
  443. -- Copyright (c) 2017, 2019, 2020 by German A. Arias
  444. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  445. -- of this software and associated documentation files (the "Software"), to deal
  446. -- in the Software without restriction, including without limitation the rights
  447. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  448. -- copies of the Software, and to permit persons to whom the Software is
  449. -- furnished to do so, subject to the following conditions:
  450. --
  451. -- The above copyright notice and this permission notice shall be included in
  452. -- all copies or substantial portions of the Software.
  453. --
  454. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  455. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  456. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  457. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  458. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  459. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  460. -- SOFTWARE.