Esempio n. 1
0
void Gradient::addColorStop(float value, const Color& color)
{
    float r;
    float g;
    float b;
    float a;
    color.getRGBA(r, g, b, a);
    m_stops.append(ColorStop(value, r, g, b, a));

    m_stopsSorted = false;
    platformDestroy();
}
Esempio n. 2
0
void Gradient::addColorStop(float value, const Color& color)
{
    m_stops.append(ColorStop(value,
        color.red() / 255.0f,
        color.green() / 255.0f,
        color.blue() / 255.0f,
        color.alpha() / 255.0f));

    m_stopsSorted = false;

    platformDestroy();
}
Esempio n. 3
0
void Gradient::addColorStop(float value, const Color& color)
{
    float r;
    float g;
    float b;
    float a;
    color.getRGBA(r, g, b, a);
    m_stops.append(ColorStop(value, r, g, b, a));

    m_stopsSorted = false;
    destroyShader();

    invalidateHash();
}
Esempio n. 4
0
int CanvasGradient::findStop(float value) const
{
    if (!m_stopsSorted) {
        bool addZeroStop = true;
        bool addOneStop = true;
        if (m_stops.size()) {
            qsort(m_stops.data(), m_stops.size(), sizeof(ColorStop), compareStops);
            addZeroStop = m_stops.first().stop != 0;
            addOneStop = m_stops.last().stop != 1;
        }
        if (addZeroStop)
            m_stops.insert(0, ColorStop(0, 0, 0, 0, 1));
        if (addOneStop)
            m_stops.append(ColorStop(1, 0, 0, 0, 1));
        m_stopsSorted = true;
    }

    ASSERT(value >= 0);
    ASSERT(value <= 1);

    int numStops = m_stops.size();
    ASSERT(numStops >= 2);
    ASSERT(m_lastStop < numStops - 1);

    int i = m_lastStop;
    if (value < m_stops[i].stop)
        i = 1;
    else
        i = m_lastStop + 1;

    for (; i < numStops - 1; ++i)
        if (value < m_stops[i].stop)
            break;

    m_lastStop = i - 1;
    return m_lastStop;
}
Esempio n. 5
0
void Gradient::addColorStop(float value, const Color& color)
{
    // FIXME: ExtendedColor - update this to support colors with color spaces.
    float r;
    float g;
    float b;
    float a;
    color.getRGBA(r, g, b, a);
    m_stops.append(ColorStop(value, r, g, b, a));

    m_stopsSorted = false;
    platformDestroy();

    invalidateHash();
}
Esempio n. 6
0
int CmdPlay(void* cd, Tcl_Interp* interp, int argc, char* argv[])
// Purpose: Allows XiRC script-writers to use this high-resolution
//          play command from within XiRC.
// Receive order for argv: channel, file, delay
{
  int time;

  if (argc == 2)
  {
    // Sent start stop pause resume to YahCoLoRiZe if the playback timer
    // locally is not operating
    if (!TimerID)
      SendToColorize(M_PLAY, argv[1]);
    else // pause resume or stop local file playback
    {
      if (!strcmp(strlwr(argv[1]), "stop")) // Convert to lower-case
        ColorStop();
      else if (!strcmp(strlwr(argv[1]), "pause"))
        ColorPause();
      else if (!strcmp(strlwr(argv[1]), "resume"))
        ColorResume();
    }
  }
  else if (argc == 3)
    ColorStart(NULL, argv[1], argv[2], 1500, false);
  else if (argc == 4)
  {
    time = atoi(argv[3]);

    if (time <= 100)
      time = 1500;

    ColorStart(NULL, argv[1], argv[2], time, false);
  }
  else
    (*Tcl_Eval)(interp,
         "echo \"Usage: /play <channel> <filename> <delay in ms>\"");

  UNREFERENCED_PARAMETER(cd);
  UNREFERENCED_PARAMETER(argc);
  UNREFERENCED_PARAMETER(argv);
	return TCL_OK;
}
Esempio n. 7
0
// The DLL entry-point function sets up shared memory using
// a named file-mapping object.
BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL,  // DLL module handle
    DWORD fdwReason,                    // reason called
    LPVOID lpvReserved)                 // reserved
{

    switch (fdwReason)
    {
          // The DLL is loading due to process
          // initialization or a call to LoadLibrary.
          case DLL_PROCESS_ATTACH:

            // Called each time StartLocalFilePlay() or StopPlay() is called
            // and when Xircon loads the script
      			hInst = hinstDLL;

            // Look for Tcl DLL in three places...
            // This is hard-coded - but to get the folder from the system is
            // a pain... and may cause security level problems in Vista and up.
            // You would need to use SHGetSpecialFolder(CSIDL_PROGRAM_FILESX86)
            // #define CSIDL_PROGRAM_FILES 0x0026
            // #define CSIDL_PROGRAM_FILESX86 0x002a
     			  hXircTcl = LoadLibrary(XTCLPATH1);
            if (hXircTcl <= (HMODULE)HINSTANCE_ERROR)
         			hXircTcl = LoadLibrary(XTCLPATH2);
            if (hXircTcl <= (HMODULE)HINSTANCE_ERROR)
         			hXircTcl = LoadLibrary(XTCLPATH3);

            if (hXircTcl > (HMODULE)HINSTANCE_ERROR)
            {
      				Tcl_CreateCommand = (dyn_CreateCommand)GetProcAddress(hXircTcl,
                                                       "_Tcl_CreateCommand");

      				Tcl_AppendResult = (dyn_AppendResult)GetProcAddress(hXircTcl,
                                                     "_Tcl_AppendResult");

      				Tcl_Eval = (dyn_Eval)GetProcAddress(hXircTcl,
                                                       "_Tcl_Eval");
      				Tcl_DoOneEvent = (dyn_DoOneEvent)GetProcAddress(hXircTcl,
                                                       "_Tcl_DoOneEvent");
              if (Tcl_CreateCommand == NULL ||
                  Tcl_AppendResult == NULL ||
                  Tcl_Eval == NULL ||
                  Tcl_DoOneEvent == NULL)
              {
                ErrorHandler("Could not find all of the library"
                                                "functions in XiRCON");
                return(false);
              }
            }
            // else
            // DO NOT PUT ERROR MESSAGE HERE, ONLY XIRCON
            // NEEDS the tcl part of this DLL!!!!!!!!!!!!

            // Create a named file mapping object.
            hMapObject = CreateFileMapping(
                (HANDLE) 0xFFFFFFFF, // use paging file
                NULL,                // no security attributes
                PAGE_READWRITE,      // read/write access

                0,                   // size: high 32-bits
                sizeof(DTS_Color),   // size: low 32-bits
                "dllmemfilemap");    // name of map object

            if (hMapObject == INVALID_HANDLE_VALUE)
            {
              ErrorHandler("Error creating shared memory");
              return FALSE;
            }

            // Get a pointer to the file-mapped shared memory.
            lpvMem = MapViewOfFile(

                hMapObject,     // object to map view of
                FILE_MAP_WRITE, // read/write access
                0,              // high offset:  map from
                0,              // low offset:   beginning
                0);             // default: map entire file

            if (lpvMem == NULL)
            {
              ErrorHandler("Error getting pointer to shared memory");
              return FALSE;
            }

            pDTS_Color = (DTS_Color*)lpvMem;
            pDTS_Color->Filename[0] = NULLCHAR;
            pDTS_Color->Channel[0] = NULLCHAR;
            pDTS_Color->Service[0] = NULLCHAR;
            pDTS_Color->PlayTime = 0; // PlayTime < 0 means "one-line" mode
            pDTS_Color->FiFoIn = 0;
            pDTS_Color->FiFoOut = 0;
            pDTS_Color->bStart = pDTS_Color->bStop = false;
            pDTS_Color->bPause = pDTS_Color->bResume = false;
            pDTS_Color->bUseDDE = false;
            pDTS_Color->bUseFile = false;

            /* allocate memory for DDE/TCL Command string */
            if ((GlobalString = (char*)malloc(GLOBALSTRINGSIZ)) == NULL)
            {
              ErrorHandler("Error allocating command buffer");
              return FALSE;
            }


            break;

        // The attached process creates a new thread.
        case DLL_THREAD_ATTACH:
            break;

        // The thread of the attached process terminates.
        case DLL_THREAD_DETACH:
            break;

        // The DLL is unloading from a process due to
        // process termination or a call to FreeLibrary
        // for either program.
        case DLL_PROCESS_DETACH:

            // for mIRC, stop immediately, for XiRCON, queue a stop command
            ColorStop();

            if (pDTS_Color->bUseDDE)
            {
              DdeFreeStringHandle(idInst, hszService);
              DdeFreeStringHandle(idInst, hszTopic);
              DdeFreeStringHandle(idInst, hszItem);
              DdeUninitialize(idInst);
            }

            // Unmap shared memory from the process's address space.
            (void)UnmapViewOfFile(lpvMem);

            // Close the process's handle to the file-mapping object.
            if (hMapObject)
            {
              (void)CloseHandle(hMapObject);
              hMapObject = NULL;
            }

            // Finished with the library
            if (hXircTcl)
            {
              FreeLibrary(hXircTcl);
              hXircTcl = NULL;
            }

            // Finished with DDE string buffer
            if (GlobalString != NULL)
            {
              free(GlobalString);
              GlobalString = NULL;
            }

            break;

        default:
          break;
     }

    UNREFERENCED_PARAMETER(lpvReserved);
    return TRUE;
}