Guiliani  Version 2.5 revision 7293 (documentation build 13)
GUIBitmapPlane.h
1/*
2* Copyright (C) TES Electronic Solutions GmbH,
3* All Rights Reserved.
4* Contact: info@guiliani.de
5*
6* This file is part of the Guiliani HMI framework
7* for the development of graphical user interfaces on embedded systems.
8*/
9
10#if !defined GUIBASEBITMAP__H_
11#define GUIBASEBITMAP__H_
12
13#include "eC.h"
14#include "GUITrace.h"
15#include "GUICommonEnums.h"
16
17class CGfxWrap;
18
145typedef eC_UInt GUIBitmapPlaneID_t;
146
148
152{
153 friend class CGfxWrap;
154
155public:
156 // ---------------- 2D interface ----------------------------
158
165 void SetPos2D(eC_Value vXPos, eC_Value vYPos);
166
172 void SetXPos2D(eC_Value vXPos);
173
179 void SetYPos2D(eC_Value vYPos);
180
184 eC_Value GetXPos2D() const;
185
189 eC_Value GetYPos2D() const;
191
192 // ------------ 3D interface -----------------------
194
201 void SetPos3D(eC_Value vXPos, eC_Value vYPos, eC_Value vZPos)
202 {
203 SetXPos3D(vXPos);
204 SetYPos3D(vYPos);
205 SetZPos3D(vZPos);
206 }
207
212 void SetXPos3D(const eC_Value vXPos)
213 {
214 m_vXPos = vXPos;
215 }
216
221 void SetYPos3D(const eC_Value vYPos)
222 {
223 m_vYPos = vYPos;
224 }
225
230 void SetZPos3D(const eC_Value vZPos)
231 {
232 m_vZPos = vZPos;
233 }
234
238 eC_Value GetXPos() const
239 {
240 return m_vXPos;
241 }
242
246 eC_Value GetYPos() const
247 {
248 return m_vYPos;
249 }
250
254 eC_Value GetZPos() const
255 {
256 return m_vZPos;
257 }
259
261 // ------------ Rotation interface ---------------
265 void RotateX(const eC_Value vXAngle)
266 {
267 m_vXAngle = vXAngle;
268 }
269
273 void RotateY(const eC_Value vYAngle)
274 {
275 m_vYAngle = vYAngle;
276 }
277
281 void RotateZ(const eC_Value vZAngle)
282 {
283 m_vZAngle = vZAngle;
284 }
285
289 eC_Value GetXAngle() const
290 {
291 return m_vXAngle;
292 }
293
297 eC_Value GetYAngle() const
298 {
299 return m_vYAngle;
300 }
301
305 eC_Value GetZAngle() const
306 {
307 return m_vZAngle;
308 }
309
314
318 GUIBitmapPlaneID_t GetID() const
319 {
320 return m_uiID;
321 }
324
328 virtual void SetWidth(eC_Value vWidth, eC_Bool bExpandCentered = false);
329
333 eC_Value GetWidth() const
334 {
335 return m_vWidth;
336 }
337
341 eC_Value GetWidthCorrected() const;
342
347 virtual void SetHeight(eC_Value vHeight, eC_Bool bExpandCentered = false);
348
352 inline eC_Value GetHeight() const
353 {
354 return m_vHeight;
355 }
356
360 eC_Value GetHeightCorrected() const;
361
365 void SetBytesPerPixel(const eC_UByte& ubBPP)
366 {
367 m_ubBPP = ubBPP;
368 }
369
373 eC_UByte GetBytesPerPixel() const
374 {
375 return m_ubBPP;
376 }
377
382 {
383 m_eFormat = eFormat;
384 }
385
390 {
391 return m_eFormat;
392 }
393
399 void SetAutoScale(const eC_Bool bAutoScale)
400 {
401 m_bAutoScale = bAutoScale;
402 }
403
405
407
411 virtual void DoDraw();
412
416 virtual void GetData(eC_TArray<eC_UByte>* pkData) {}
417
425 virtual void Clear(
426 const eC_UByte ubRed = 0,
427 const eC_UByte ubGreen = 0,
428 const eC_UByte ubBlue = 0,
429 const eC_UByte ubAlpha = 0)
430 {}
431
436 {
437 return m_rkParentObject;
438 }
439
446 virtual void SetAlphaValues(
447 const eC_UByte ubTopLeft, const eC_UByte ubBottomLeft,
448 const eC_UByte ubBottomRight, const eC_UByte ubTopRight)
449 {
450 }
451
456 void SetAlphaValue(const eC_UByte ubAlpha)
457 {
458 SetAlphaValues(ubAlpha, ubAlpha, ubAlpha, ubAlpha);
459 }
460
462 // -------------- UV interface --------------------------------
463 //---- Top Left --
465
473 virtual void SetTopLeftU(eC_Value vU);
474
478 virtual eC_Value GetTopLeftU();
479
487 virtual void SetTopLeftV(eC_Value vV);
488
492 virtual eC_Value GetTopLeftV();
493
499 void SetTopLeftUV(eC_Value vU, eC_Value vV)
500 {
501 SetTopLeftU(vU);
502 SetTopLeftV(vV);
503 }
505
506 //---- Bottom Left --
508
516 virtual void SetBottomLeftU(eC_Value vU);
517
521 virtual eC_Value GetBottomLeftU();
522
530 virtual void SetBottomLeftV(eC_Value vV);
531
535 virtual eC_Value GetBottomLeftV();
536
542 void SetBottomLeftUV(eC_Value vU, eC_Value vV)
543 {
544 SetBottomLeftU(vU);
545 SetBottomLeftV(vV);
546 }
548
549 //--- Bottom Right
551
559 virtual void SetBottomRightU(eC_Value vU);
560
564 virtual eC_Value GetBottomRightU();
565
573 virtual void SetBottomRightV(eC_Value vV);
574
578 virtual eC_Value GetBottomRightV();
579
585 void SetBottomRightUV(eC_Value vU, eC_Value vV)
586 {
587 SetBottomRightU(vU);
588 SetBottomRightV(vV);
589 }
591
592 //---- Top Right ----
594
602 virtual void SetTopRightU(eC_Value vU);
603
607 virtual eC_Value GetTopRightU();
608
616 virtual void SetTopRightV(eC_Value vV);
617
621 virtual eC_Value GetTopRightV();
622
628 void SetTopRightUV(eC_Value vU, eC_Value vV)
629 {
630 SetTopRightU(vU);
631 SetTopRightV(vV);
632 }
633
635
637
645 {
646 m_bDepthTest = true;
647 }
648
656 {
657 m_bDepthTest = false;
658 }
659
665 eC_Bool IsDepthTestEnabled() const
666 {
667 return m_bDepthTest;
668 }
669
673 virtual eC_Value Get2DPlaneDistance();
674
676 eC_Value GetFOV() const
677 {
678 return m_vFOV;
679 }
680
682 void SetFOV(const eC_Value vFOV)
683 {
684 m_vFOV = vFOV;
685 //we need to recalculate the 2dplane distance and therefore the z pos
686 eC_Value vZ = m_vZPos - m_v2DPlaneDistance;
687 m_v2DPlaneDistance = eC_FromInt(0);
688 m_uiScreenWidth = 0;
690 m_vZPos = Get2DPlaneDistance() + vZ;
691 }
692
694 eC_Value GetNear() const
695 {
696 return ms_vNear;
697 }
698
700 eC_Value GetFar() const
701 {
702 return ms_vFar;
703 }
704
706 eC_Bool IsYFlipped() const
707 {
708 return m_bYFlipped;
709 }
710
712protected:
719 CGUIBitmapPlane(GUIBitmapPlaneID_t uiNewBitmapID, const CGUIObject& rkParentObject, eC_Value vWidth = 0, eC_Value vHeight = 0);
720
721 virtual ~CGUIBitmapPlane();
724
727 virtual eC_Bool FinishDrawToBitmap() { return true; }
728
732 virtual eC_Bool DrawToBitmap() { return true; }
733
737 virtual eC_Bool DrawToScreen() { return true; }
739
745
751
755 void SetTexUsed(eC_Value vNewTexUsedU, eC_Value vNewTexUsedV);
756
759
762
763 eC_Bool m_bAutoScale;
764
765 eC_TArray<eC_Value> m_avUVValues;
766
768 eC_Value m_vTexUsedU;
770 eC_Value m_vTexUsedV;
771
775
776 eC_Bool m_bYFlipped;
777
778private:
783
784 GUIBitmapPlaneID_t m_uiID;
785
786 const CGUIObject& m_rkParentObject;
787
788 eC_Value m_vXPos;
789 eC_Value m_vYPos;
790 eC_Value m_vZPos;
791
792 eC_Value m_vXAngle;
793 eC_Value m_vYAngle;
794 eC_Value m_vZAngle;
795
796 eC_Value m_vWidth;
797 eC_Value m_vHeight;
798 eC_UByte m_ubBPP;
800
801 eC_Bool m_bDepthTest;
802
803 eC_Value m_vFOV;
804 static eC_Value ms_vNear;
805 static eC_Value ms_vFar;
806};
807
808#endif
The bitmap plane base class.
Definition: GUIBitmapPlane.h:152
void SetBottomRightUV(eC_Value vU, eC_Value vV)
Definition: GUIBitmapPlane.h:585
eC_Value GetHeight() const
Definition: GUIBitmapPlane.h:352
void DisableDepthTest()
Definition: GUIBitmapPlane.h:655
eC_Value GetZPos() const
Definition: GUIBitmapPlane.h:254
void SetAlphaValue(const eC_UByte ubAlpha)
Definition: GUIBitmapPlane.h:456
virtual eC_Value GetTopRightU()
void SetTexUsed(eC_Value vNewTexUsedU, eC_Value vNewTexUsedV)
virtual void SetBottomRightU(eC_Value vU)
virtual eC_Value GetBottomRightU()
GUIBitmapPlaneID_t GetID() const
Definition: GUIBitmapPlane.h:318
eC_Bool IsYFlipped() const
Definition: GUIBitmapPlane.h:706
eC_Value GetCenterOfProjectionAbsX() const
virtual eC_Bool DrawToBitmap()
Definition: GUIBitmapPlane.h:732
virtual void SetBottomLeftV(eC_Value vV)
eC_Value GetYPos2D() const
virtual eC_Value GetBottomLeftU()
void ResetRotation()
CGUIBitmapPlane(GUIBitmapPlaneID_t uiNewBitmapID, const CGUIObject &rkParentObject, eC_Value vWidth=0, eC_Value vHeight=0)
eC_Value GetFOV() const
Definition: GUIBitmapPlane.h:676
void SetFOV(const eC_Value vFOV)
Definition: GUIBitmapPlane.h:682
void SetFormat(const CGUICommonEnums::ImageType_t &eFormat)
Definition: GUIBitmapPlane.h:381
virtual eC_Value GetBottomLeftV()
virtual eC_Value GetTopRightV()
void RotateZ(const eC_Value vZAngle)
Definition: GUIBitmapPlane.h:281
eC_Value GetNear() const
Definition: GUIBitmapPlane.h:694
void SetBottomLeftUV(eC_Value vU, eC_Value vV)
Definition: GUIBitmapPlane.h:542
void SetPos2D(eC_Value vXPos, eC_Value vYPos)
eC_Value GetHeightCorrected() const
eC_UByte GetBytesPerPixel() const
Definition: GUIBitmapPlane.h:373
virtual void SetHeight(eC_Value vHeight, eC_Bool bExpandCentered=false)
eC_Value m_vTexUsedU
Used space/unused space in x direction in the Bitmap, due to Power of two limitations [0 1].
Definition: GUIBitmapPlane.h:768
void RotateY(const eC_Value vYAngle)
Definition: GUIBitmapPlane.h:273
eC_Value GetFar() const
Definition: GUIBitmapPlane.h:700
virtual eC_Value GetTopLeftU()
void EnableDepthTest()
Definition: GUIBitmapPlane.h:644
virtual void GetData(eC_TArray< eC_UByte > *pkData)
Definition: GUIBitmapPlane.h:416
virtual void SetTopLeftV(eC_Value vV)
void SetBytesPerPixel(const eC_UByte &ubBPP)
Definition: GUIBitmapPlane.h:365
void SetXPos2D(eC_Value vXPos)
void SetXPos3D(const eC_Value vXPos)
Definition: GUIBitmapPlane.h:212
virtual eC_Value GetBottomRightV()
virtual void SetTopRightU(eC_Value vU)
eC_TArray< eC_Value > m_avUVValues
array containing the uv values for all four plane corners
Definition: GUIBitmapPlane.h:765
void SetTopLeftUV(eC_Value vU, eC_Value vV)
Definition: GUIBitmapPlane.h:499
eC_Value GetXPos() const
Definition: GUIBitmapPlane.h:238
virtual void Clear(const eC_UByte ubRed=0, const eC_UByte ubGreen=0, const eC_UByte ubBlue=0, const eC_UByte ubAlpha=0)
Definition: GUIBitmapPlane.h:425
eC_Value GetYPos() const
Definition: GUIBitmapPlane.h:246
void SetAutoScale(const eC_Bool bAutoScale)
Definition: GUIBitmapPlane.h:399
eC_Bool m_bYFlipped
if data is upside down
Definition: GUIBitmapPlane.h:776
eC_Value GetXPos2D() const
eC_UInt m_uiScreenWidth
screen width, used to identify screen changes on calculation of 2DPlaneDistance
Definition: GUIBitmapPlane.h:772
void RotateX(const eC_Value vXAngle)
Definition: GUIBitmapPlane.h:265
eC_Value GetZAngle() const
Definition: GUIBitmapPlane.h:305
eC_Bool IsDepthTestEnabled() const
Definition: GUIBitmapPlane.h:665
void SetPos3D(eC_Value vXPos, eC_Value vYPos, eC_Value vZPos)
Definition: GUIBitmapPlane.h:201
void SetZPos3D(const eC_Value vZPos)
Definition: GUIBitmapPlane.h:230
virtual eC_Value GetTopLeftV()
virtual void SetBottomRightV(eC_Value vV)
virtual void SetWidth(eC_Value vWidth, eC_Bool bExpandCentered=false)
virtual void SetBottomLeftU(eC_Value vU)
void SetTopRightUV(eC_Value vU, eC_Value vV)
Definition: GUIBitmapPlane.h:628
virtual eC_Bool FinishDrawToBitmap()
Definition: GUIBitmapPlane.h:727
void SetYPos2D(eC_Value vYPos)
virtual eC_Bool DrawToScreen()
Definition: GUIBitmapPlane.h:737
virtual void SetAlphaValues(const eC_UByte ubTopLeft, const eC_UByte ubBottomLeft, const eC_UByte ubBottomRight, const eC_UByte ubTopRight)
Definition: GUIBitmapPlane.h:446
eC_Value m_v2DPlaneDistance
2DPlaneDistance
Definition: GUIBitmapPlane.h:774
eC_Value GetWidth() const
Definition: GUIBitmapPlane.h:333
virtual void SetTopLeftU(eC_Value vU)
virtual eC_Value Get2DPlaneDistance()
eC_UInt m_uiScreenHeight
screen height, used to identify screen changes on calculation of 2DPlaneDistance
Definition: GUIBitmapPlane.h:773
void SetYPos3D(const eC_Value vYPos)
Definition: GUIBitmapPlane.h:221
eC_Value m_vGUIObjectInitHeight
Height of the GUIObject at creation time of this BitmapPlane.
Definition: GUIBitmapPlane.h:761
eC_Value GetYAngle() const
Definition: GUIBitmapPlane.h:297
eC_Value GetCenterOfProjectionAbsY() const
const CGUIObject & GetParentGUIObject() const
Definition: GUIBitmapPlane.h:435
eC_Value m_vGUIObjectInitWidth
Width of the GUIObject at creation time of this BitmapPlane.
Definition: GUIBitmapPlane.h:758
CGUICommonEnums::ImageType_t GetFormat() const
Definition: GUIBitmapPlane.h:389
virtual void DoDraw()
eC_Bool m_bAutoScale
flag describing a bitmap plane will be automatically be scaled on GUIObject scale
Definition: GUIBitmapPlane.h:763
virtual void SetTopRightV(eC_Value vV)
eC_Value GetWidthCorrected() const
eC_Value GetXAngle() const
Definition: GUIBitmapPlane.h:289
eC_Value m_vTexUsedV
Used space/unused space in y direction in the Bitmap, due to Power of two limitations [0 1].
Definition: GUIBitmapPlane.h:770
ImageType_t
Definition: GUICommonEnums.h:80
This is the Guiliani base class all controls are derived from.
Definition: GUIObject.h:79
The graphics wrapper base class.
Definition: GfxWrap.h:84