Example #1
0
    def __init__(self, wnd, w, h, units, bgcolor):

        self._viewport = Viewport(self, 0, 0, w, h, bgcolor)
        self._rect = 0, 0, w, h

        self._wnd = wnd
        self._bgcolor = bgcolor or (0, 0, 0)

        import winuser
        desktop = winuser.GetDesktopWindow()

        self._ddraw = ddraw.CreateDirectDraw()
        self._ddraw.SetCooperativeLevel(desktop.GetSafeHwnd(), ddraw.DDSCL_NORMAL)

        ddsd = ddraw.CreateDDSURFACEDESC()
        ddsd.SetFlags(ddraw.DDSD_CAPS)
        ddsd.SetCaps(ddraw.DDSCAPS_PRIMARYSURFACE)
        self._frontBuffer = self._ddraw.CreateSurface(ddsd)
        self._pxlfmt = self._frontBuffer.GetPixelFormat()

        ddsd = ddraw.CreateDDSURFACEDESC()
        ddsd.SetFlags(ddraw.DDSD_WIDTH | ddraw.DDSD_HEIGHT | ddraw.DDSD_CAPS)
        ddsd.SetCaps(ddraw.DDSCAPS_OFFSCREENPLAIN)
        ddsd.SetSize(w, h)
        self._backBuffer = self._ddraw.CreateSurface(ddsd)

        self._ddbgcolor = self._backBuffer.GetColorMatch(self._bgcolor or (255,255,255))
        self._backBuffer.BltFill((0, 0, w, h), self._ddbgcolor)
Example #2
0
    def __init__(self, wnd, w, h, units, bgcolor):

        self._viewport = Viewport(self, 0, 0, w, h, bgcolor)
        self._rect = 0, 0, w, h

        self._wnd = wnd
        self._bgcolor = bgcolor or (0, 0, 0)

        self._ddraw = ddraw.CreateDirectDraw()
        self._ddraw.SetCooperativeLevel(wnd.GetSafeHwnd(), ddraw.DDSCL_NORMAL)

        ddsd = ddraw.CreateDDSURFACEDESC()
        ddsd.SetFlags(ddraw.DDSD_CAPS)
        ddsd.SetCaps(ddraw.DDSCAPS_PRIMARYSURFACE)
        self._frontBuffer = self._ddraw.CreateSurface(ddsd)
        self._pxlfmt = self._frontBuffer.GetPixelFormat()

        ddsd = ddraw.CreateDDSURFACEDESC()
        ddsd.SetFlags(ddraw.DDSD_WIDTH | ddraw.DDSD_HEIGHT | ddraw.DDSD_CAPS)
        ddsd.SetCaps(ddraw.DDSCAPS_OFFSCREENPLAIN)
        ddsd.SetSize(w, h)
        self._backBuffer = self._ddraw.CreateSurface(ddsd)

        self._clipper = self._ddraw.CreateClipper(wnd.GetSafeHwnd())
        self._frontBuffer.SetClipper(self._clipper)

        self._ddbgcolor = self._backBuffer.GetColorMatch(self._bgcolor or (255,255,255))
        self._backBuffer.BltFill((0, 0, w, h), self._ddbgcolor)

        self._wnd.HookMessage(self.OnPaint, win32con.WM_PAINT)
Example #3
0
    def OnCreate(self, params):
        w, h = self._w, self._h

        self.__ddraw = ddraw.CreateDirectDraw()
        self.__ddraw.SetCooperativeLevel(self.GetSafeHwnd(),
                                         ddraw.DDSCL_NORMAL)

        ddsd = ddraw.CreateDDSURFACEDESC()
        ddsd.SetFlags(ddraw.DDSD_CAPS)
        ddsd.SetCaps(ddraw.DDSCAPS_PRIMARYSURFACE)
        self.__frontBuffer = self.__ddraw.CreateSurface(ddsd)

        self.__clipper = self.__ddraw.CreateClipper(self.GetSafeHwnd())
        self.__frontBuffer.SetClipper(self.__clipper)

        self._pxlfmt = self.__frontBuffer.GetPixelFormat()

        ddsd = ddraw.CreateDDSURFACEDESC()
        ddsd.SetFlags(ddraw.DDSD_WIDTH | ddraw.DDSD_HEIGHT | ddraw.DDSD_CAPS)
        ddsd.SetCaps(ddraw.DDSCAPS_OFFSCREENPLAIN)
        ddsd.SetSize(w, h)
        self.__backBuffer = self.__ddraw.CreateSurface(ddsd)

        url = r'D:\ufs\mm\cmif\Build\common\testdoc\testdatampg.mpg'
        self._mmstream = MMStream(self.__ddraw)
        self._mmstream.open(url)
        self._mmstream.run()

        self.__init_it()
        self.HookMessage(self.OnTimer, win32con.WM_TIMER)
        self.__timer_id = self.SetTimer(1, 50)
Example #4
0
    def OnCreate(self, params):
        # back buffer size
        w, h = self.GetClientRect()[2:]

        self.__ddraw = ddraw.CreateDirectDraw()

        self.__ddraw.SetCooperativeLevel(self.GetSafeHwnd(),
                                         ddraw.DDSCL_NORMAL)

        ddsd = ddraw.CreateDDSURFACEDESC()
        ddsd.SetFlags(ddraw.DDSD_CAPS)
        ddsd.SetCaps(ddraw.DDSCAPS_PRIMARYSURFACE)
        self.__frontBuffer = self.__ddraw.CreateSurface(ddsd)

        ddsd = ddraw.CreateDDSURFACEDESC()
        ddsd.SetFlags(ddraw.DDSD_WIDTH | ddraw.DDSD_HEIGHT | ddraw.DDSD_CAPS)
        ddsd.SetCaps(ddraw.DDSCAPS_OFFSCREENPLAIN)
        ddsd.SetSize(w, h)
        self.__backBuffer = self.__ddraw.CreateSurface(ddsd)

        self.__clipper = self.__ddraw.CreateClipper(self.GetSafeHwnd())
        self.__frontBuffer.SetClipper(self.__clipper)
        self._pxlfmt = self.__frontBuffer.GetPixelFormat()

        # clear back buffer
        ddcolor = self.__backBuffer.GetColorMatch(self.__bgcolor
                                                  or (255, 255, 255))
        self.__backBuffer.BltFill((0, 0, w, h), ddcolor)

        self.createDirectDrawQt(self.__ddraw, self._movieRect[2:])

        self.HookMessage(self.OnTimer, win32con.WM_TIMER)
        self.__timer_id = self.SetTimer(1, self.TIMER_TICK)
Example #5
0
 def createDDSurface():
     # create a ddraw surface with this size
     import ddraw, winuser
     ddrawobj = ddraw.CreateDirectDraw()
     ddrawobj.SetCooperativeLevel(winuser.GetDesktopWindow().GetSafeHwnd(),
                                  ddraw.DDSCL_NORMAL)
     ddsd = ddraw.CreateDDSURFACEDESC()
     ddsd.SetFlags(ddraw.DDSD_CAPS)
     ddsd.SetCaps(ddraw.DDSCAPS_PRIMARYSURFACE)
     frontBuffer = ddrawobj.CreateSurface(ddsd)
     frontBuffer.GetPixelFormat()
     return ddrawobj, frontBuffer
Example #6
0
    def OnCreate(self, params):
        self.__ddraw = ddraw.CreateDirectDraw()

        self.__ddraw.SetCooperativeLevel(self.GetSafeHwnd(),
                                         ddraw.DDSCL_NORMAL)

        self.__frontBuffer = self.__ddraw.CreateSurface()
        self.__backBuffer = self.__ddraw.CreateSurface(400, 300)

        self.__clipper = self.__ddraw.CreateClipper(self.GetSafeHwnd())
        self.__frontBuffer.SetClipper(self.__clipper)

        self.__init_it()
        self.HookMessage(self.OnTimer, win32con.WM_TIMER)
        self.__timer_id = self.SetTimer(1, 20)
Example #7
0
    def _initddraw(self):
        movie_w = self.videodescr['width']
        movie_h = self.videodescr['height']
        movie_rect = (0, 0, movie_w, movie_h)

        ddrawobj = ddraw.CreateDirectDraw()
        ddrawobj.SetCooperativeLevel(0, ddraw.DDSCL_NORMAL)

        ddsd = ddraw.CreateDDSURFACEDESC()
        ddsd.SetFlags(ddraw.DDSD_WIDTH | ddraw.DDSD_HEIGHT | ddraw.DDSD_CAPS)
        ddsd.SetCaps(ddraw.DDSCAPS_OFFSCREENPLAIN)
        ddsd.SetSize(movie_w, movie_h)
        dds = ddrawobj.CreateSurface(ddsd)
        pxlfmt = dds.GetPixelFormat()
        Qt.SetDDObject(ddrawobj)
        Qt.SetDDPrimarySurface(dds)
        self._ddrawobj = ddrawobj
        self._dds = dds
        self.pxlfmt = pxlfmt

        self.movie.SetMovieBox(movie_rect)
        self.movie.SetMovieActive(1)
        self.movie.MoviesTask(0)
        self.movie.SetMoviePlayHints(winqtcon.hintsHighQuality, winqtcon.hintsHighQuality)
Example #8
0
        gear32sd.image_delete(img)



###########################################

# viewport dimensions
w = 400
h = 300


###########################################
import ddraw

# create direct draw stuff
ddrawobj = ddraw.CreateDirectDraw()

# we need a window here, so use desktop
import win32ui
Sdk = win32ui.GetWin32Sdk()
ddrawobj.SetCooperativeLevel(Sdk.GetDesktopWindow().GetSafeHwnd(), ddraw.DDSCL_NORMAL)

# create our dd surface
ddsd = ddraw.CreateDDSURFACEDESC()
ddsd.SetFlags(ddraw.DDSD_WIDTH | ddraw.DDSD_HEIGHT | ddraw.DDSD_CAPS)
ddsd.SetCaps(ddraw.DDSCAPS_OFFSCREENPLAIN)
ddsd.SetSize(w,h)
dds = ddrawobj.CreateSurface(ddsd)
pxlfmt = dds.GetPixelFormat()

ddcolor = dds.GetColorMatch((0,0,255))