×

Discussion Board

Results 1 to 10 of 10

Thread: saving graphics

  1. #1
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    52

    saving graphics

    hello,

    I am developing an drawing application (for Nokia series 60) where I need to save the graphics built on the screen by my program.

    How can I do it?


    Thank you in advance,
    Julia

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143
    in case you need to get the screen image, that you could do like this:

    CEikonEnv::Static()->ScreenDevice()->CopyScreenToBitmap(ScreenBitmap);

    For the savings, you could see SDK docs & examples.

    With OS 6.1 (SDK 1.X), see CMdaImageBitmapToFileUtility class, and for OS 7.0/8.0 (SDK 2.x) see CImageEncoder class.

    yucca

  3. #3
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    52
    Thank you for responsing. I use SDK 2.1.

    Sorry for the stupid question, but I'm new in Symbian programming.

    My application includes UI, View & Container files. I've added in
    UI file treatment of Save command, function SaveL in View file, and draw function in Container file.
    Do I try to use right structure???

    I included fbs.h in view header and fbscli.lib in mmp.
    Also in view header CFbsBitmap* iBitmap,
    in View.cpp ConstructL(): iBitmap = new (ELeave) CFbsBitmap();
    (I'm going to use CEikonEnv::Static()->ScreenDevice()->CopyScreenToBitmap(iBitmap)
    And after adding 2 lines about Bitmap I have a lot of mistakes:
    unresolved external symbol public: _thiscall CFbsBitmap::CFbsBitmap(void) ...
    cannot open input file appname.exp etc.
    What is problem may be here???
    And for saving I shoud use something like this:
    CMdaImageBitmapToFileUtility* iFileSaver;
    iFileSaver->CreateL(KBmpFileName,&iClipFormat,&iCodec,&iCodec); ???

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143
    at least the "unresolved external symbol " is caused by the fact that the implementation of the class is not found. So check SDK docs for the needed library, add it to your mmp file and re-build your workspace. Then it should work

    yucca

  5. #5
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    52
    I'm sure that implementation of CFbsBitmap() is inside of the fbscli.lib (included in mmp file). I've found according line inside the library file.
    My application is very simple, 1 view class: public CAknView, 1 container class: public CCoeControl. And after adding one string iBitmap = new (ELeave) CFbsBitmap();
    I've got a lot of mistakes (see below). What can be another reason for it ???????


    ------ Build started: Project: BASICDRAWING, Configuration: Uni Debug Win32 ------

    Building resources from Basicdrawing_caption.rss
    perl -S epocrc.pl -I "\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP" -I "\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP" -I "\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\INC" -I- -I "\Symbian\7.0s\Series60_v21\EPOC32\INCLUDE" -DLANGUAGE_01 -u "\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\Basicdrawing_caption.rss" -o"\Symbian\7.0s\Series60_v21\EPOC32\RELEASE\WINS\UDEB\Z\SYSTEM\APPS\BASICDRAWING\BASICDRAWING_CAPTION.r01" -h"\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING_CAPTION.rs~" -t"\Symbian\7.0s\Series60_v21\EPOC32\BUILD\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING\WINS\UDEB"
    perl -S ecopyfile.pl "\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING_CAPTION.rs~" "\Symbian\7.0s\Series60_v21\EPOC32\INCLUDE\BASICDRAWING_CAPTION.RSG"
    del "\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING_CAPTION.rs~"
    Building resources from Basicdrawing.rss
    perl -S epocrc.pl -I "\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP" -I "\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP" -I "\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\INC" -I- -I "\Symbian\7.0s\Series60_v21\EPOC32\INCLUDE" -DLANGUAGE_01 -u "\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\Basicdrawing.rss" -o"\Symbian\7.0s\Series60_v21\EPOC32\RELEASE\WINS\UDEB\Z\SYSTEM\APPS\BASICDRAWING\BASICDRAWING.r01" -h"\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING.rs~" -t"\Symbian\7.0s\Series60_v21\EPOC32\BUILD\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING\WINS\UDEB"
    perl -S ecopyfile.pl "\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING.rs~" "\Symbian\7.0s\Series60_v21\EPOC32\INCLUDE\BASICDRAWING.RSG"
    del "\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING.rs~"
    Compiling...
    Basicdrawing.uid.cpp
    BasicDrawingView.cpp
    BasicDrawingDocument.cpp
    BasicDrawingContainer.cpp
    BasicDrawingAppUi.cpp
    BasicDrawingApp.cpp
    Generating Code...
    Performing Pre-Link Event...
    Doing first-stage link by name
    link.exe @C:\DOCUME~1\JULIAF~1\LOCALS~1\Temp\nm210.tmp
    LINK : warning LNK4044: unrecognized option '/WARN:3'; ignored
    Creating library \Symbian\7.0s\Series60_v21\EPOC32\BUILD\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING\WINS\UDEB\BASICDRAWING.lib and object \Symbian\7.0s\Series60_v21\EPOC32\BUILD\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING\WINS\UDEB\BASICDRAWING.exp
    BASICDRAWINGCONTAINER.obj : error LNK2019: unresolved external symbol "public: __thiscall CFbsBitmap::CFbsBitmap(void)" (??0CFbsBitmap@@QAE@XZ) referenced in function "private: void __thiscall CBasicDrawingContainer::ConstructL(class TRect const &)" (?ConstructL@CBasicDrawingContainer@@AAEXABVTRect@@@Z)
    \Symbian\7.0s\Series60_v21\EPOC32\BUILD\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING\WINS\UDEB\BASICDRAWING.APP : fatal error LNK1120: 1 unresolved externals
    NMAKE : fatal error U1077: 'link.exe' : return code '0x460'
    Stop.
    if exist "\Symbian\7.0s\Series60_v21\EPOC32\BUILD\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING\WINS\UDEB\BASICDRAWING.exp" del "\Symbian\7.0s\Series60_v21\EPOC32\BUILD\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING\WINS\UDEB\BASICDRAWING.exp"
    Stopped the build by removing the export object,
    if present, because the pre-link stage failed
    Linking...
    LINK : warning LNK4044: unrecognized option '/WARN:3'; ignored
    LINK : fatal error LNK1181: cannot open input file '\Symbian\7.0s\Series60_v21\EPOC32\BUILD\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING\WINS\UDEB\BASICDRAWING.exp'

    Build log was saved at "file://C:\Symbian\7.0s\Series60_v21\EPOC32\BUILD\SYMBIAN\7.0S\SERIES60_V21\SERIES60EX\BASICDRAWING\GROUP\BASICDRAWING\WINS\UDEB\BuildLog.htm"
    BASICDRAWING - 4 error(s), 2 warning(s)

  6. #6
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143
    did you remember to re-build (or re-import from mmp file) your project, so all changes done into the mmp file would be then taking afect on your project.

    yucca

  7. #7
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    52
    Hello,
    Thank you, I didn't know about it.
    Now I use:
    TInt err = iBitmap->Create(TSize(176,208),EColor64K);
    CEikonEnv::Static()->ScreenDevice()->CopyScreenToBitmap(iBitmap);
    iBitmap->Save(_L("test.mbm"));

    And I've got picture with top pane and menu in the bottom: Select & cancel.
    How I can use only middle part of the screen???

  8. #8
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    I don't think there is a simple solution that you could use to grab just a part of the screen. The obvious solution would be to take the bitmap as you do and then create a smaller one to which you copy only TRect(TPoin(0,44), TSize(176,144)) from the big one.

  9. #9
    Regular Contributor
    Join Date
    Nov 2004
    Posts
    52
    Hello,
    Thank you for responsing.
    Also I can use second parameter of CopyScreenToBitmap() TRect to define grabbed part, but how I can set it exactly? It seems to me that different models can have different sizes of screen and I should not use "hard-coding" to set for example (0,44), (176,144)

  10. #10
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    No, at least not now.
    Series60 platform is defined as having screen size 176x208 and you can count on it. (top 44 pixels are for title bar, 144 pixels in the middle are for client area and 20 pixels at the bottom are for command button area)

    This will radically change with Feature Pack 3 when new screen sizes will be introduced. FP3 should support scalable UI framework with SVG and these screen resolutions: 176 x 208, 208 x 208, 240 x 320 QVGA, 352 x 416

    But it will take some time before the first device with FP3 will be available...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •