examples/Multimedia/ImageConv/src/CImageAppView.cpp

00001 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // This component and the accompanying materials are made available
00004 // under the terms of "Eclipse Public License v1.0"
00005 // which accompanies this distribution, and is available
00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00007 //
00008 // Initial Contributors:
00009 // Nokia Corporation - initial contribution.
00010 //
00011 // Contributors:
00012 //
00013 // Description:
00014 // CImageAppView
00015 //
00016 
00017 #include "CImageAppView.h"
00018 
00019 // Construct empty window
00020 void CImageAppView::ConstructL(const TRect& /*aRect*/)
00021     {
00022         CreateWindowL();
00023 #if defined(__WINS__)
00024         Window().SetRequiredDisplayMode(EColor256);
00025 #endif
00026         Window().SetBackgroundColor(KRgbDarkBlue);
00027     SetExtentToWholeScreen();
00028         ActivateL();
00029         }
00030 
00031 // Get display mode
00032 TDisplayMode CImageAppView::DisplayMode() const
00033         {
00034         return Window().DisplayMode();
00035         }
00036 
00037 // Draw view
00038 void CImageAppView::Draw(const TRect& /*aRect*/) const
00039         {
00040         CWindowGc& gc = SystemGc();
00041 
00042         if (iBitmap && iBitmap->Handle())
00043                 {
00044                 TSize bitmapSize(iBitmap->SizeInPixels());
00045                 TPoint pt;
00046                 pt.iX = (Rect().Width() - bitmapSize.iWidth) / 2;
00047                 pt.iY = (Rect().Height() - bitmapSize.iHeight) / 2;
00048                 gc.BitBlt(pt,iBitmap);
00049                 }
00050         else
00051                 gc.Clear();
00052         }
00053 
00054 // Draw view on demand
00055 void CImageAppView::DrawBitmapNow()
00056         {
00057         CWindowGc& gc = SystemGc();
00058         gc.Activate(Window());
00059         Draw(Rect());
00060         gc.Deactivate();
00061         ControlEnv()->WsSession().Flush();
00062         }
00063 
00064 // Clear view
00065 void CImageAppView::Clear()
00066         {
00067         CWindowGc& gc = SystemGc();
00068         gc.Activate(Window());
00069         gc.Clear();
00070         gc.Deactivate();
00071         ControlEnv()->WsSession().Flush();
00072         }
00073 
00074 // Set bitmap to draw
00075 void CImageAppView::SetBitmap(CFbsBitmap* aBitmap)
00076         {
00077         iBitmap = aBitmap;
00078         }

Generated on Thu Jan 21 10:32:59 2010 for TB10.1 Example Applications by  doxygen 1.5.3