Wide Studio Object Reference

| Wide Studio Object Reference |
Wide Studio Home
Up to
  ## Class Name WSDmwindowDev ## Specification of methods ### getGeometry Function Description Form void getGeometry(WSCushort* w,WSCushort* y) Function Obtain height and width of the current drawing area Description Parameters
  (out)WSCushort* w | Width
  (out)WSCushort* h | Height

Return value
  None
Notice
Samples

        WSDmwindowDev* mdev = WSDmwindowDev::getNewInstance();
        mdev->createPixmap(200,200);
        WSCushort w,h;
        mdev->getGeometry(&w,&h) //200,200 is returned

  ### copyToWindow Function Description

  Form
    long copyToWindow(WSDdev* dev,short x,short y,WSCushort w,WSCushort y,short dx,short dy)
  Function
    Copy a specified region image on a specified window system resource instance
  Description
  Parameters

    (in)WSDdev* dev | Window system resource instance
    (in)short x | Copy source X coordinate
    (in)short y | Copy source Y coordinate
    (in)WSCushort w | Copy source area width
    (in)WSCushort h | Copy source area hieght
    (in)short dx | Copy destination X coordinate
    (in)short dy | Copy destination Y coordinate

  Return value
    WS_NO_ERR= Normal, otherwise error
  Notice
  Samples
    Display image 001.jpg appearing gradually

        #include <WSCcolorSet.h>
        #include <WSCimageSet.h>
        #include <WSCmainWindow.h>
        extern WSCmainWindow* newwin000;

        #include <WSDmwindowDev.h>
        WSDmwindowDev* mdev = NULL;
        WSDmwindowDev* mdev2 = NULL;

        void btnep(WSCbase* object){
          WSDdev* dev = newwin000->getdev();
          if (mdev == NULL){
            mdev = WSDmwindowDev::getNewInstance();
            mdev2 = WSDmwindowDev::getNewInstance();
          }
          mdev->createPixmap(200,200);
          mdev->beginDraw(0,0,200,200);
          WSDimage* image = WSGIappImageSet()->getImage("001.jpg");
          mdev->drawStretchedImage(0,0,200,200,image);
          mdev->endDraw();

          mdev2->createPixmap(200,200);

          mdev->initBuffer();
          mdev2->initBuffer();

          long i,x,y;
          for(i=0;i<100; i++){
            for(x=0; x<200; x++){
              for(y=0; y<200; y++){
                WSCuchar r,g,b;
                mdev->getBufferRGB(x,y,&r,&g,&b);
                r = (WSCushort)((double)(r*i)/100);
                g = (WSCushort)((double)(g*i)/100);
                b = (WSCushort)((double)(b*i)/100);
                mdev2->setBufferRGB(x,y,r,g,b);
              }
            }
            mdev2->putBufferToPixmap();
            mdev2->copyToWindow(dev,0,0,200,200,0,0);
          }
        }
        static WSCfunctionRegister  op("btnep",(void*)btnep);

  ### copyFromWindow Function Description

  Form
    long copyFromWindow(WSDdev* dev,short x,short y,WSCushort w,WSCushort y,short dx,short dy)
  Function
    Copy a specified region image to a specified window system resource instance.
  Description
  Parameters

    (in)WSDdev* dev | Window system resource instance
    (in)short x | Copy source X coordinate
    (in)short y | Copy source Y coordinate
    (in)WSCushort w | Copy source area width
    (in)WSCushort h | Copy source area hieght
    (in)short dx | Copy destination X coordinate
    (in)short dy | Copy destination Y coordinate

  Return value
    WS_NO_ERR= Normal, otherwise error
  Notice
  Samples

            //Copy the contents of newwin000 onto memory drawing instance
            WSDdev* dev = newwin000->getdev();
            mdev->copyFromWindow(dev,0,0,200,200,0,0);

  ### copyToWindowWithMask Function Description

  Form
    long copyToWindowWithMask(WSDdev* dev,short x,short y,WSCushort w,WSCushort y,short dx,short dy,WSDimage* mask)
  Function
    Copy a specified region image of specified window system resource instance
  Description
    Copy image by masking with a specified black and white
  Parameters

    (in)WSDdev* dev | Window system resource instance
    (in)short x | Copy source X coordinate
    (in)short y | Copy source Y coordinate
    (in)WSCushort w | Copy source area width
    (in)WSCushort h | Copy source area hieght
    (in)short dx | Copy destination X coordinate
    (in)short dy | Copy destination Y coordinate
    (in)WSDimage* mask | Masking image

  Return value
    WS_NO_ERR= Normal, otherwise error
  Notice
  Samples

            //Copy the contents of a memory drawing instance mdev masking with mask.jpg onto newwin000
            WSDdev* dev = newwin000->getdev();
            WSDimage* mask = WSGIappImageSet()->getImage("mask.jpg");
            mdev->copyFromWindow(dev,0,0,200,200,0,0,mask);

  ### copyToWindowWithMask Function Description

  Form
    long copyToWindowWithMask(WSDdev* dev,short x,short y,WSCushort w,WSCushort y,short dx,short dy,WSDmwindowDev* mask)
  Function
    Copy a specified region image of a specified window system resource instance
  Description
    Copy image by masking with a specified black and white
  Parameters

    (in)WSDdev* dev | Window system resource instance
    (in)short x | Copy source X coordinate
    (in)short y | Copy source Y coordinate
    (in)WSCushort w | Copy source area width
    (in)WSCushort h | Copy source area hieght
    (in)short dx | Copy destination X coordinate
    (in)short dy | Copy destination Y coordinate
    (in)WSDimage* mask | Masking image

  Return value
    WS_NO_ERR= Normal, otherwise error
  Notice
  Samples

            //Copy the contents of a memory drawing instance mdev masking with mask.jpg onto newwin000
            WSDdev* dev = newwin000->getdev();
            mdev->copyFromWindow(dev,0,0,200,200,0,0,mdev2);

  ### initBuffer Function Description

  Form
    long initBuffer()
  Function
    Allocate a buffer which can input/output an WSDmindowDev image
  Description
    It should be called before operating an image by setBufferRGB/getBufferRGB member function
  Parameters
    None
  Return value
    WS_NO_ERR= Normal, otherwise error
  Notice
  Samples
    Refer to copyToWindow()

  ### setBufferRGB Function Description

  Form
    long setBufferRGB(WSCushort x,WSCushort y,WSCuchar r,WSCuchar g,WSCuchar b);
  Function
    Set RGB value to a specified coordinate dot
  Description
    It should be called before operating an image by setBufferRGB/getBufferRGB member function
  Parameters

    (in)WSCushort x | X coordinate
    (in)WSCushort y | Y coordinate
    (in)WSCuchar r | Red
    (in)WSCuchar g | Green
    (in)WSCuchar b | Blue

  Return value
    WS_NO_ERR= Normal, otherwise error
  Notice
  Samples
    Refer to copyToWindow()

  ### getBufferRGB Function Description

  Form
    long getBufferRGB(WSCushort x,WSCushort y,WSCuchar* r,WSCuchar* g,WSCuchar* b);
  Function
    Obtain RGB value of a specified coordinate dot
  Description
    It should be called before operating an image by setBufferRGB/getBufferRGB member function
  Parameters

    (in)WSCushort x | Obtain X coordinate
    (in)WSCushort y | Obtain Y coordinate
    (in)WSCuchar r | Obtain Red
    (in)WSCuchar g | Obtain Green
    (in)WSCuchar b | Obtain Blue

  Return value
    WS_NO_ERR= Normal, otherwise error
  Notice
  Samples
    Refer to copyToWindow()

  ### putBufferToPixmap Function Description

  Form
    long putBufferToPixmap()
  Function
    Effect the contents of an operated I/O-enabled buffer to an image buffer
  Description
  Parameters
    None
  Return value
    WS_NO_ERR= Normal, otherwise error
  Notice
  Samples
    Refer to copyToWindow()

  Document Release 3.20
  For use with Wide Studio Release 3.20, Spring 2003

  Wide Studio Home | Up to

  Copyright(C) T. Hirabayashi, 1999-2003 |  | Last modified: February 3, 2003