Image.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. #ifndef Bild_H
  2. #define Bild_H
  3. #include "Array.h"
  4. #include "Point.h"
  5. #include "Drawing.h"
  6. namespace Framework
  7. {
  8. class Bild; //! from this file
  9. #ifdef WIN32
  10. class VScrollBar; //! Scroll.h
  11. class HScrollBar; //! Scroll.h
  12. class Rahmen; //! Border.h
  13. struct MausEreignis; //! MouseEvent.h
  14. class Text; //! Text.h
  15. #endif
  16. //! Manages an image as an array of pixel colors in A8R8G8B8 format
  17. //! that can be drawn to
  18. class Bild : public virtual ReferenceCounter
  19. {
  20. private:
  21. int* fc;
  22. bool delFc;
  23. Punkt size;
  24. Punkt* drawOff;
  25. Punkt* dPosA;
  26. Punkt* dSizeA;
  27. int doa;
  28. unsigned char* alpha;
  29. int alphaAnzahl;
  30. bool rend;
  31. bool alpha3D;
  32. //! private
  33. inline void alphaPixelP(int x, int y, int f);
  34. inline void alphaPixelP3D(int x, int y, int f);
  35. inline void alphaPixelP(int& fc, int f);
  36. inline void alphaPixelP3D(int& fc, int f);
  37. inline void alphaPixelAssozP(int& fc, int f);
  38. inline char getOutCode(Punkt p) const;
  39. void drawFlatDreieck(
  40. int y1, int y2, float m1, float b1, float m2, float b2, int farbe);
  41. void drawFlatDreieckTextur(int y1,
  42. int y2,
  43. double m1,
  44. double b1,
  45. double m2,
  46. double b2,
  47. double tx1,
  48. double ty1,
  49. double tx2,
  50. double ty2,
  51. double tx_1o,
  52. double ty_1o,
  53. double tx_2o,
  54. double ty_2o,
  55. double txf,
  56. double tyf,
  57. const Bild& textur);
  58. void drawFlatDreieckAlpha(
  59. int y1, int y2, float m1, float b1, float m2, float b2, int farbe);
  60. void drawFlatDreieckTexturAlpha(int y1,
  61. int y2,
  62. double m1,
  63. double b1,
  64. double m2,
  65. double b2,
  66. double tx1,
  67. double ty1,
  68. double tx2,
  69. double ty2,
  70. double tx_1o,
  71. double ty_1o,
  72. double tx_2o,
  73. double ty_2o,
  74. double txf,
  75. double tyf,
  76. const Bild& textur);
  77. void drawLinieHTextur(Vec2<double> p,
  78. double length,
  79. Vec2<double> ta,
  80. Vec2<double> tb,
  81. double txo,
  82. double tyo,
  83. const Bild& textur);
  84. void drawLinieHTexturAlpha(Vec2<double> p,
  85. double length,
  86. Vec2<double> ta,
  87. Vec2<double> tb,
  88. double txo,
  89. double tyo,
  90. const Bild& textur);
  91. public:
  92. //! Constructor
  93. //! \param options 1 if the image should create buffers for drawing,
  94. //! such as for temporary drawing area boundaries and
  95. //! transparency filters
  96. //! Uses about 50 kb more memory per image
  97. DLLEXPORT Bild(bool options = 0);
  98. //! Destructor
  99. DLLEXPORT ~Bild();
  100. //! Checks whether a rectangle is fully or partially within the drawing
  101. //! area.
  102. //! return 0 if the rectangle is not in the drawing area, 1 otherwise
  103. DLLEXPORT bool isAreaDrawable(int x, int y, int width, int height);
  104. //! If this flag is set, when alpha blending and the previous color
  105. //! is 0, the new color is only copied with its alpha value.
  106. //! This is useful for use in the 3D screen, where the drawn image
  107. //! is later displayed using alpha blending. The flag is set
  108. //! automatically in the 3D screen
  109. DLLEXPORT void setAlpha3D(bool erlaubt);
  110. //! Sets the minimum transparency of everything drawn next,
  111. //! until the corresponding releaseAlpha() call is made.
  112. DLLEXPORT void setAlpha(unsigned char alpha);
  113. //! Removes the last alpha limit set with setAlpha()
  114. DLLEXPORT void releaseAlpha();
  115. //! Sets a pointer to the pixels to draw into
  116. //! \param buffer An array with A8R8G8B8 color values
  117. //! \param deleteBuffer 1 if the array should be deleted by the image
  118. //! \param breite The width in pixels
  119. //! \param height The height in pixels
  120. DLLEXPORT void setPixelBuffer(
  121. int* buffer, bool deleteBuffer, int breite, int height);
  122. //! Creates a new image
  123. //! \param breite The width of the image in pixels
  124. //! \param hoehe The height of the image in pixels
  125. //! \param fillColor The initial color all pixels are set to
  126. DLLEXPORT void neuBild(int breite, int height, int fillColor);
  127. //! Blends a color onto a specific pixel using alpha blending.
  128. //! Does not respect the drawing area boundary or scroll offset
  129. //! \param x The X coordinate of the pixel
  130. //! \param y The Y coordinate of the pixel
  131. //! \param f The color in A8R8G8B8 format to be blended
  132. DLLEXPORT void alphaPixel2D(int x, int y, int f);
  133. DLLEXPORT void alphaPixel3D(int x, int y, int f);
  134. //! Blends a color onto a specific pixel using alpha blending.
  135. //! Does not respect the drawing area boundary or scroll offset
  136. //! \param i The index of the pixel in the pixel array
  137. //! \param f The color in A8R8G8B8 format to be blended
  138. DLLEXPORT void alphaPixel2D(int i, int f);
  139. DLLEXPORT void alphaPixel3D(int i, int f);
  140. //! Blends a color onto a specific pixel using alpha blending
  141. //! \param x The X coordinate of the pixel
  142. //! \param y The Y coordinate of the pixel
  143. //! \param f The color in A8R8G8B8 format to be blended
  144. DLLEXPORT void alphaPixelDP2D(int x, int y, int f);
  145. DLLEXPORT void alphaPixelDP3D(int x, int y, int f);
  146. //! Blends a color onto a specific pixel using alpha blending
  147. //! \param i The index of the pixel in the pixel array
  148. //! \param f The color in A8R8G8B8 format to be blended
  149. DLLEXPORT void alphaPixelDP2D(int i, int f);
  150. DLLEXPORT void alphaPixelDP3D(int i, int f);
  151. //! Sets the color of a specific pixel
  152. //! \param x The X coordinate of the pixel
  153. //! \param y The Y coordinate of the pixel
  154. //! \param f The new color in A8R8G8B8 format
  155. DLLEXPORT void setPixelDP(int x, int y, int f);
  156. //! Sets the color of a specific pixel
  157. //! \param i The index of the pixel in the pixel array
  158. //! \param f The new color in A8R8G8B8 format
  159. DLLEXPORT void setPixelDP(int i, int f);
  160. //! Sets the color of all pixels in the image
  161. //! \param f The new color
  162. DLLEXPORT void setFarbe(int f);
  163. //! Sets the colors of all pixels in a rectangle
  164. //! \param x The X coordinate
  165. //! \param y The Y coordinate
  166. //! \param b The width of the rectangle
  167. //! \param h The height of the rectangle
  168. //! \param fc The color in A8R8G8B8 format
  169. DLLEXPORT void fillRegion(int x, int y, int b, int h, int fc);
  170. //! Blends a color with alpha blending into a rectangle
  171. //! \param x The X coordinate
  172. //! \param y The Y coordinate
  173. //! \param b The width of the rectangle
  174. //! \param h The height of the rectangle
  175. //! \param fc The color in A8R8G8B8 format
  176. DLLEXPORT void alphaRegion(int x, int y, int b, int h, int fc);
  177. //! Draws a horizontal line
  178. //! \param x The X coordinate of the starting point
  179. //! \param y The Y coordinate of the starting point
  180. //! \param length The length of the line
  181. //! \param fc The color in A8R8G8B8 format
  182. DLLEXPORT void drawLinieH(int x, int y, int length, int fc);
  183. //! Draws a vertical line
  184. //! \param x The X coordinate of the starting point
  185. //! \param y The Y coordinate of the starting point
  186. //! \param length The length of the line
  187. //! \param fc The color in A8R8G8B8 format
  188. DLLEXPORT void drawLinieV(int x, int y, int length, int fc);
  189. //! Draws a horizontal line with alpha blending
  190. //! \param x The X coordinate of the starting point
  191. //! \param y The Y coordinate of the starting point
  192. //! \param length The length of the line
  193. //! \param fc The color in A8R8G8B8 format
  194. DLLEXPORT void drawLinieHAlpha(int x, int y, int length, int fc);
  195. //! Draws a vertical line with alpha blending
  196. //! \param x The X coordinate of the starting point
  197. //! \param y The Y coordinate of the starting point
  198. //! \param length The length of the line
  199. //! \param fc The color in A8R8G8B8 format
  200. DLLEXPORT void drawLinieVAlpha(int x, int y, int length, int fc);
  201. //! Draws a bordered line
  202. //! \param a The starting point of the line
  203. //! \param b The ending point of the line
  204. //! \param bc The border color in A8R8G8B8 format
  205. //! \param fc The color in A8R8G8B8 format
  206. DLLEXPORT void drawLinieBordered(Punkt a, Punkt b, int bc, int fc);
  207. //! Draws a bordered line with alpha blending
  208. //! \param a The starting point of the line
  209. //! \param b The ending point of the line
  210. //! \param bc The border color in A8R8G8B8 format
  211. //! \param fc The color in A8R8G8B8 format
  212. DLLEXPORT void drawLinieBorderedAlpha(Punkt a, Punkt b, int bc, int fc);
  213. //! Draws a line
  214. //! \param a The starting point of the line
  215. //! \param b The ending point of the line
  216. //! \param fc The color in A8R8G8B8 format
  217. DLLEXPORT void drawLinie(Punkt a, Punkt b, int fc);
  218. //! Draws a line with alpha blending
  219. //! \param a The starting point of the line
  220. //! \param b The ending point of the line
  221. //! \param fc The color in A8R8G8B8 format
  222. DLLEXPORT void drawLinieAlpha(Punkt a, Punkt b, int fc);
  223. //! Fills a circle with a color. (Unfinished)
  224. //! \param xOff The X coordinate of the circle center
  225. //! \param yOff The Y coordinate of the circle center
  226. //! \param r The radius of the circle in pixels
  227. //! \param fc The color in A8R8G8B8 format
  228. DLLEXPORT void fillCircle(int xOff, int yOff, int r, int fc);
  229. //! Draws the outline of a circle
  230. //! \param xOff The X coordinate of the circle center
  231. //! \param yOff The Y coordinate of the circle center
  232. //! \param r The radius of the circle in pixels
  233. //! \param fc The color in A8R8G8B8 format
  234. DLLEXPORT void drawKreis(int xOff, int yOff, int r, int fc);
  235. //! Draws the outline of a circle with alpha blending
  236. //! \param xOff The X coordinate of the circle center
  237. //! \param yOff The Y coordinate of the circle center
  238. //! \param r The radius of the circle in pixels
  239. //! \param fc The color in A8R8G8B8 format
  240. DLLEXPORT void drawKreisAlpha(int xOff, int yOff, int r, int fc);
  241. //! Draws an image into a specific area without scaling
  242. //! \param x The X coordinate of the top left corner of the target area
  243. //! \param y The Y coordinate of the top left corner of the target area
  244. //! \param br The width of the target area
  245. //! \param hi The height of the target area
  246. //! \param zBild The image to be drawn
  247. DLLEXPORT void drawBild(
  248. int x, int y, int br, int hi, const Bild& zBild);
  249. //! Draws an image into a specific area without scaling with alpha
  250. //! blending
  251. //! \param x The X coordinate of the top left corner of the target area
  252. //! \param y The Y coordinate of the top left corner of the target area
  253. //! \param br The width of the target area
  254. //! \param hi The height of the target area
  255. //! \param zBild The image to be drawn
  256. DLLEXPORT void alphaBild(
  257. int x, int y, int br, int hi, const Bild& zBild);
  258. //! Draws an image into a specific area without scaling with associative
  259. //! alpha blending
  260. //! \param x The X coordinate of the top left corner of the target area
  261. //! \param y The Y coordinate of the top left corner of the target area
  262. //! \param br The width of the target area
  263. //! \param hi The height of the target area
  264. //! \param zBild The image to be drawn
  265. DLLEXPORT void alphaBildAssoz(
  266. int x, int y, int br, int hi, const Bild& zBild);
  267. //! Draws an image rotated 90 degrees clockwise into a specific area
  268. //! without scaling
  269. //! \param x The X coordinate of the top left corner of the target area
  270. //! \param y The Y coordinate of the top left corner of the target area
  271. //! \param br The width of the target area
  272. //! \param hi The height of the target area
  273. //! \param zBild The image to be drawn
  274. DLLEXPORT void drawBild90(
  275. int x, int y, int br, int hi, const Bild& zBild);
  276. //! Draws an image rotated 90 degrees clockwise into a specific area
  277. //! without scaling with alpha blending
  278. //! \param x The X coordinate of the top left corner of the target area
  279. //! \param y The Y coordinate of the top left corner of the target area
  280. //! \param br The width of the target area
  281. //! \param hi The height of the target area
  282. //! \param zBild The image to be drawn
  283. DLLEXPORT void alphaBild90(
  284. int x, int y, int br, int hi, const Bild& zBild);
  285. //! Draws an image rotated 180 degrees into a specific area
  286. //! without scaling
  287. //! \param x The X coordinate of the top left corner of the target area
  288. //! \param y The Y coordinate of the top left corner of the target area
  289. //! \param br The width of the target area
  290. //! \param hi The height of the target area
  291. //! \param zBild The image to be drawn
  292. DLLEXPORT void drawBild180(
  293. int x, int y, int br, int hi, const Bild& zBild);
  294. //! Draws an image rotated 180 degrees into a specific area
  295. //! without scaling with alpha blending
  296. //! \param x The X coordinate of the top left corner of the target area
  297. //! \param y The Y coordinate of the top left corner of the target area
  298. //! \param br The width of the target area
  299. //! \param hi The height of the target area
  300. //! \param zBild The image to be drawn
  301. DLLEXPORT void alphaBild180(
  302. int x, int y, int br, int hi, const Bild& zBild);
  303. //! Draws an image rotated 270 degrees clockwise into a specific area
  304. //! without scaling
  305. //! \param x The X coordinate of the top left corner of the target area
  306. //! \param y The Y coordinate of the top left corner of the target area
  307. //! \param br The width of the target area
  308. //! \param hi The height of the target area
  309. //! \param zBild The image to be drawn
  310. DLLEXPORT void drawBild270(
  311. int x, int y, int br, int hi, const Bild& zBild);
  312. //! Draws an image rotated 270 degrees clockwise into a specific area
  313. //! without scaling with alpha blending
  314. //! \param x The X coordinate of the top left corner of the target area
  315. //! \param y The Y coordinate of the top left corner of the target area
  316. //! \param br The width of the target area
  317. //! \param hi The height of the target area
  318. //! \param zBild The image to be drawn
  319. DLLEXPORT void alphaBild270(
  320. int x, int y, int br, int hi, const Bild& zBild);
  321. //! Draws an image into a specific area with scaling
  322. //! \param x The X coordinate of the top left corner of the target area
  323. //! \param y The Y coordinate of the top left corner of the target area
  324. //! \param br The width of the target area
  325. //! \param hi The height of the target area
  326. //! \param zBild The image to be drawn
  327. DLLEXPORT void drawBildSkall(
  328. int x, int y, int br, int hi, const Bild& zBild);
  329. //! Draws an image into a specific area with scaling and alpha blending
  330. //! \param x The X coordinate of the top left corner of the target area
  331. //! \param y The Y coordinate of the top left corner of the target area
  332. //! \param br The width of the target area
  333. //! \param hi The height of the target area
  334. //! \param zBild The image to be drawn
  335. DLLEXPORT void alphaBildSkall(
  336. int x, int y, int br, int hi, const Bild& zBild);
  337. //! Fills a triangle with a specific color
  338. //! \param a A corner of the triangle
  339. //! \param b A corner of the triangle
  340. //! \param c A corner of the triangle
  341. //! \param farbe The color in A8R8G8B8 format
  342. DLLEXPORT void drawDreieck(Punkt a, Punkt b, Punkt c, int farbe);
  343. //! Fills a triangle with a specific texture
  344. //! \param a A corner of the triangle
  345. //! \param b A corner of the triangle
  346. //! \param c A corner of the triangle
  347. //! \param ta The coordinates of a in the texture
  348. //! \param tb The coordinates of b in the texture
  349. //! \param tc The coordinates of c in the texture
  350. //! \param textur The image to use as texture
  351. DLLEXPORT void drawDreieckTextur(Punkt a,
  352. Punkt b,
  353. Punkt c,
  354. Punkt ta,
  355. Punkt tb,
  356. Punkt tc,
  357. const Bild& textur);
  358. //! Fills a triangle with a specific color with alpha blending
  359. //! \param a A corner of the triangle
  360. //! \param b A corner of the triangle
  361. //! \param c A corner of the triangle
  362. //! \param farbe The color in A8R8G8B8 format
  363. DLLEXPORT void drawDreieckAlpha(Punkt a, Punkt b, Punkt c, int farbe);
  364. //! Fills a triangle with a specific texture with alpha blending
  365. //! \param a A corner of the triangle
  366. //! \param b A corner of the triangle
  367. //! \param c A corner of the triangle
  368. //! \param ta The coordinates of a in the texture
  369. //! \param tb The coordinates of b in the texture
  370. //! \param tc The coordinates of c in the texture
  371. //! \param textur The image to use as texture
  372. DLLEXPORT void drawDreieckTexturAlpha(Punkt a,
  373. Punkt b,
  374. Punkt c,
  375. Punkt ta,
  376. Punkt tb,
  377. Punkt tc,
  378. const Bild& textur);
  379. //! Replaces a specific color with transparency
  380. DLLEXPORT void replaceColorWithAlpha(int color);
  381. //! Restricts the drawing area until the next call of
  382. //! releaseDrawOptions(). Everything outside the area is automatically
  383. //! ignored. If the drawing area extends beyond an existing drawing area,
  384. //! it is automatically clipped to the existing one.
  385. //! \param pos The coordinates of the top left corner of the drawing area
  386. //! \param gr The size of the drawing area
  387. //! \return 1 if the new drawing area is fully or partially within the
  388. //! existing drawing area. If 0 is returned, the drawing area was not set
  389. //! and releaseDrawOptions() does not need to be called
  390. DLLEXPORT bool setDrawOptions(const Punkt& pos, const Punkt& gr);
  391. //! Restricts the drawing area until the next call of
  392. //! releaseDrawOptions(). Everything outside the area is automatically
  393. //! ignored. If the drawing area extends beyond an existing drawing area,
  394. //! it is automatically clipped to the existing one.
  395. //! \param x The X coordinate of the top left corner of the drawing area
  396. //! \param y The Y coordinate of the top left corner of the drawing area
  397. //! \param br The width of the drawing area
  398. //! \param hi The height of the drawing area
  399. //! \return 1 if the new drawing area is fully or partially within the
  400. //! existing drawing area. If 0 is returned, the drawing area was not set
  401. //! and releaseDrawOptions() does not need to be called
  402. DLLEXPORT bool setDrawOptions(int x, int y, int br, int hi);
  403. //! Restricts the drawing area until the next call of
  404. //! releaseDrawOptions(). Everything outside the area is automatically
  405. //! ignored. The drawing area may extend beyond an existing drawing area.
  406. //! \param pos The coordinates of the top left corner of the drawing area
  407. //! \param gr The size of the drawing area
  408. //! \return 1 if the new drawing area is fully or partially within the
  409. //! image. If 0 is returned, the drawing area was not set and
  410. //! releaseDrawOptions() does not need to be called
  411. DLLEXPORT bool setDrawOptionsErzwingen(
  412. const Punkt& pos, const Punkt& gr);
  413. //! Restricts the drawing area until the next call of
  414. //! releaseDrawOptions(). Everything outside the area is automatically
  415. //! ignored. The drawing area may extend beyond an existing drawing area.
  416. //! \param x The X coordinate of the top left corner of the drawing area
  417. //! \param y The Y coordinate of the top left corner of the drawing area
  418. //! \param br The width of the drawing area
  419. //! \param hi The height of the drawing area
  420. //! \return 1 if the new drawing area is fully or partially within the
  421. //! image. If 0 is returned, the drawing area was not set and
  422. //! releaseDrawOptions() does not need to be called
  423. DLLEXPORT bool setDrawOptionsErzwingen(int x, int y, int br, int hi);
  424. //! Resets draw options to image size
  425. DLLEXPORT void setDrawOptionsReset();
  426. //! Sets coordinates that are subtracted from positions in drawing
  427. //! functions. A drawing area should have been set with setDrawOptions
  428. //! beforehand. The values are reset with the call of
  429. //! releaseDrawOptions().
  430. //! \param xOff A value subtracted from all X coordinates
  431. //! \param yOff A value subtracted from all Y coordinates
  432. DLLEXPORT void addScrollOffset(int xOff, int yOff);
  433. //! Removes the last set drawing area restriction and all scroll offsets
  434. //! set since then. Restores the previous drawing area and its
  435. //! associated scroll offsets
  436. DLLEXPORT void releaseDrawOptions();
  437. //! Returns whether the image has changed since the last call of this
  438. //! function
  439. DLLEXPORT bool getRend();
  440. //! Returns the array of A8R8G8B8 pixel color values.
  441. //! The index of a pixel is calculated as x + y * image width
  442. DLLEXPORT int* getBuffer() const;
  443. //! Returns the A8R8G8B8 color value of a pixel
  444. //! \param x The X coordinate of the pixel
  445. //! \param y The Y coordinate of the pixel
  446. DLLEXPORT int getPixel(int x, int y) const;
  447. //! Returns the size of the image
  448. DLLEXPORT const Punkt& getSize() const;
  449. //! Returns the width of the image
  450. DLLEXPORT int getBreite() const;
  451. //! Returns the height of the image
  452. DLLEXPORT int getHeight() const;
  453. //! Returns the current minimum transparency value
  454. DLLEXPORT unsigned char getAlpha() const;
  455. //! Returns the coordinates of the top left corner of the current
  456. //! drawing area
  457. DLLEXPORT const Punkt& getDrawPos() const;
  458. //! Returns the size of the current drawing area
  459. DLLEXPORT const Punkt& getDrawGr() const;
  460. //! Returns the coordinates added to all positions before drawing
  461. DLLEXPORT const Punkt& getDrawOff() const;
  462. //! If this flag is set, when alpha blending and the previous color
  463. //! is 0, the new color is only copied with its alpha value.
  464. //! This is useful for use in the 3D screen, where the drawn image
  465. //! is later displayed using alpha blending. The flag is set
  466. //! automatically in the 3D screen
  467. DLLEXPORT bool hasAlpha3D() const;
  468. //! Calculates the average color of all pixels in the image
  469. DLLEXPORT int getAverageColor() const;
  470. };
  471. //! A 2D GUI Framework drawing that displays an image.
  472. class BildZ : public ZeichnungHintergrund
  473. {
  474. public:
  475. class Style : public ZeichnungHintergrund::Style
  476. {
  477. public:
  478. //! If this flag is set, alpha blending is used when drawing
  479. //! the image
  480. static const __int64 Alpha = 0x1000;
  481. //! If this flag is set, the image is scaled to the drawing area
  482. static const __int64 Skalliert = 0x2000;
  483. //! The normal style of an image drawing consisting of HScroll,
  484. //! Sichtbar, Erlaubt, Rahmen, VScroll
  485. static const __int64 normal
  486. = HScroll | Sichtbar | Erlaubt | Rahmen | VScroll;
  487. };
  488. private:
  489. Bild* bild;
  490. protected:
  491. //! Processes a mouse event. Called automatically by the framework.
  492. //! \param me The event
  493. DLLEXPORT void doMausEreignis(MausEreignis& me, bool userRet) override;
  494. public:
  495. //! Constructor
  496. DLLEXPORT BildZ();
  497. //! Destructor
  498. DLLEXPORT virtual ~BildZ();
  499. //! Sets a pointer to the image to be displayed
  500. //! \param b The image
  501. DLLEXPORT void setBildZ(Bild* b);
  502. //! Sets the image to be displayed. The image content is copied
  503. //! \param b The image
  504. DLLEXPORT void setBild(Bild* b);
  505. //! Updates the drawing background
  506. //! \param tickVal The elapsed time in seconds since the last call
  507. //! of this function
  508. //! \return 1 if the image needs to be redrawn. 0 otherwise
  509. DLLEXPORT bool tick(double tickVal) override;
  510. //! Draws the drawing into a specific image
  511. //! \param zRObj The image to draw into
  512. DLLEXPORT void render(Bild& zRObj) override;
  513. //! Returns the displayed image
  514. DLLEXPORT Bild* getBild() const;
  515. //! Returns the displayed image without increased reference counter
  516. DLLEXPORT Bild* zBild() const;
  517. //! Copies the complete drawing so it can be modified without
  518. //! affecting the original
  519. DLLEXPORT Zeichnung* dublizieren() const override;
  520. };
  521. #ifdef WIN32
  522. //! Loads an image from a .bmp, .jpg, .gif or .png file
  523. //! \param pfad The path to the image file
  524. //! \param zError A pointer to a Text object where a possible error is
  525. //! returned
  526. //! \return The loaded image
  527. DLLEXPORT Bild* ladeBild(const char* pfad, Text* zError);
  528. #endif
  529. } // namespace Framework
  530. #endif