コード例 #1
0
ファイル: al_Buffer.hpp プロジェクト: LuaAV/LuaAV
	/// If the requested size is larger than the current capacity, then the 
	/// buffer will be resized.
	void size(int n){
		if(capacity() < n) resize(n);
		else setSize(n);
	}
コード例 #2
0
ファイル: umatrix.cpp プロジェクト: jtkb/opencv
UMat Mat::getUMat(int accessFlags, UMatUsageFlags usageFlags) const
{
    UMat hdr;
    if(!data)
        return hdr;
    if (data != datastart)
    {
        Size wholeSize;
        Point ofs;
        locateROI(wholeSize, ofs);
        Size sz(cols, rows);
        if (ofs.x != 0 || ofs.y != 0)
        {
            Mat src = *this;
            int dtop = ofs.y;
            int dbottom = wholeSize.height - src.rows - ofs.y;
            int dleft = ofs.x;
            int dright = wholeSize.width - src.cols - ofs.x;
            src.adjustROI(dtop, dbottom, dleft, dright);
            return src.getUMat(accessFlags, usageFlags)(cv::Rect(ofs.x, ofs.y, sz.width, sz.height));
        }
    }
    CV_Assert(data == datastart);

    accessFlags |= ACCESS_RW;
    UMatData* new_u = NULL;
    {
        MatAllocator *a = allocator, *a0 = getDefaultAllocator();
        if(!a)
            a = a0;
        new_u = a->allocate(dims, size.p, type(), data, step.p, accessFlags, usageFlags);
    }
    bool allocated = false;
    try
    {
        allocated = UMat::getStdAllocator()->allocate(new_u, accessFlags, usageFlags);
    }
    catch (const cv::Exception& e)
    {
        fprintf(stderr, "Exception: %s\n", e.what());
    }
    if (!allocated)
    {
        allocated = getDefaultAllocator()->allocate(new_u, accessFlags, usageFlags);
        CV_Assert(allocated);
    }
    if (u != NULL)
    {
#ifdef HAVE_OPENCL
        if (ocl::useOpenCL() && new_u->currAllocator == ocl::getOpenCLAllocator())
        {
            CV_Assert(new_u->tempUMat());
        }
#endif
        new_u->originalUMatData = u;
        CV_XADD(&(u->refcount), 1);
        CV_XADD(&(u->urefcount), 1);
    }
    hdr.flags = flags;
    setSize(hdr, dims, size.p, step.p);
    finalizeHdr(hdr);
    hdr.u = new_u;
    hdr.offset = 0; //data - datastart;
    hdr.addref();
    return hdr;
}
コード例 #3
0
ファイル: rectangle.cpp プロジェクト: Sergane/ff_tasks
Rectangle::Rectangle(int w, int h){
	setSize(w, h);
}
コード例 #4
0
ファイル: MovableBox.cpp プロジェクト: olofn/db_public
MovableBox::MovableBox()
	:mBoxAnimation("data/images/movableblock.bmp",1)
	,mGravityHitTimer(0)
{
	setSize(float2(20.f,20.f));
}
コード例 #5
0
QgsLabelAttributes::QgsLabelAttributes( bool def )
    : mTextIsSet( false )
    , mFamilyIsSet( false )
    , mBoldIsSet( false )
    , mItalicIsSet( false )
    , mUnderlineIsSet( false )
    , mStrikeOutIsSet( false )
    , mSizeType( 0 )
    , mSize( 0.0 )
    , mSizeIsSet( false )
    , mColorIsSet( false )
    , mOffsetType( 0 )
    , mXOffset( 0 )
    , mYOffset( 0 )
    , mOffsetIsSet( false )
    , mAngle( 0.0 )
    , mAngleIsSet( false )
    , mAngleIsAuto( false )
    , mAlignment( 0 )
    , mAlignmentIsSet( false )
    , mBufferEnabledFlag( false )
    , mBufferSizeType( 0 )
    , mBufferSize( 0.0 )
    , mBufferSizeIsSet( false )
    , mBufferColorIsSet( false )
    , mBufferStyleIsSet( false )
    , mBorderColorIsSet( false )
    , mBorderWidthIsSet( false )
    , mBorderStyleIsSet( false )
    , mMultilineEnabledFlag( false )
    , mSelectedOnly( false )
{

  if ( def )   // set defaults
  {
    setText( QObject::tr( "Label" ) );

    mFont = QApplication::font();
    mFamilyIsSet = true;
    mBoldIsSet = true;
    mItalicIsSet = true;
    mUnderlineIsSet = true;

    setSize( 12.0, PointUnits );

    setOffset( 0, 0, PointUnits );
    setAngle( 0 );
    setAutoAngle( false );

    setAlignment( Qt::AlignCenter );
    setColor( QColor( 0, 0, 0 ) );

    setBufferSize( 1, PointUnits );
    setBufferColor( QColor( 255, 255, 255 ) );
    setBufferStyle( Qt::NoBrush );

    setBorderWidth( 0 );
    setBorderColor( QColor( 0, 0, 0 ) );
    setBorderStyle( Qt::NoPen );
  }
}
コード例 #6
0
ファイル: llimage.cpp プロジェクト: OS-Development/VW.Meerkat
U8* LLImageBase::allocateDataSize(S32 width, S32 height, S32 ncomponents, S32 size)
{
	setSize(width, height, ncomponents);
	return allocateData(size); // virtual
}
コード例 #7
0
//==============================================================================
ThorConfigComponent::ThorConfigComponent (ThorConfig *_config)
    : label (0),
      thorConfigEncodeFormat (0),
      label2 (0),
      thorOggQuality (0),
      thorVersionCheck (0),
      label3 (0),
      thorOutputAction (0),
      internalCachedImage1 (0)
{
    addAndMakeVisible (label = new Label (T("new label"),
                                          T("Ogg quality")));
    label->setFont (Font (12.0000f, Font::plain));
    label->setJustificationType (Justification::centredLeft);
    label->setEditable (false, false, false);
    label->setColour (TextEditor::textColourId, Colours::black);
    label->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (thorConfigEncodeFormat = new ComboBox (T("new combo box")));
    thorConfigEncodeFormat->setEditableText (false);
    thorConfigEncodeFormat->setJustificationType (Justification::centredLeft);
    thorConfigEncodeFormat->setTextWhenNothingSelected (String::empty);
    thorConfigEncodeFormat->setTextWhenNoChoicesAvailable (T("(no choices)"));
    thorConfigEncodeFormat->addItem (T("Ogg"), 1);
    thorConfigEncodeFormat->addItem (T("Flac"), 2);
    thorConfigEncodeFormat->addListener (this);

    addAndMakeVisible (label2 = new Label (T("new label"),
                                           T("Encode To:")));
    label2->setFont (Font (12.0000f, Font::plain));
    label2->setJustificationType (Justification::centredLeft);
    label2->setEditable (false, false, false);
    label2->setColour (TextEditor::textColourId, Colours::black);
    label2->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (thorOggQuality = new ComboBox (T("Ogg Quality")));
    thorOggQuality->setEditableText (false);
    thorOggQuality->setJustificationType (Justification::centredLeft);
    thorOggQuality->setTextWhenNothingSelected (String::empty);
    thorOggQuality->setTextWhenNoChoicesAvailable (T("(no choices)"));
    thorOggQuality->addItem (T("Low"), 1);
    thorOggQuality->addItem (T("Medium"), 2);
    thorOggQuality->addItem (T("High"), 3);
    thorOggQuality->addListener (this);

    addAndMakeVisible (thorVersionCheck = new ToggleButton (T("new toggle button")));
    thorVersionCheck->setButtonText (T("version check"));
    thorVersionCheck->addButtonListener (this);
    thorVersionCheck->setToggleState (true, false);

    addAndMakeVisible (label3 = new Label (T("new label"),
                                           T("Output:")));
    label3->setFont (Font (12.0000f, Font::plain));
    label3->setJustificationType (Justification::centredLeft);
    label3->setEditable (false, false, false);
    label3->setColour (TextEditor::textColourId, Colours::black);
    label3->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (thorOutputAction = new ComboBox (T("Ogg Quality")));
    thorOutputAction->setEditableText (false);
    thorOutputAction->setJustificationType (Justification::centredLeft);
    thorOutputAction->setTextWhenNothingSelected (String::empty);
    thorOutputAction->setTextWhenNoChoicesAvailable (T("(no choices)"));
    thorOutputAction->addItem (T("Kepp and create ZIP"), 1);
    thorOutputAction->addItem (T("Keep output DIR (no ZIP)"), 2);
    thorOutputAction->addItem (T("Keep both"), 3);
    thorOutputAction->addListener (this);

    internalCachedImage1 = ImageCache::getFromMemory (vorbis_png, vorbis_pngSize);

    //[UserPreSize]
    config = _config;
    //[/UserPreSize]

    setSize (256, 106);

    //[Constructor] You can add your own custom stuff here..
    thorOggQuality->setSelectedItemIndex (config->getOggQuality(), false);
    thorVersionCheck->setToggleState (config->getVersionCheck(), false);
    thorOutputAction->setSelectedItemIndex (config->getDefaultOutputAction(), false);

    if (config->getFileExtension() == T("flac"))
    {
        thorConfigEncodeFormat->setSelectedId (2);
    }

    if (config->getFileExtension() == T("ogg"))
    {
        thorConfigEncodeFormat->setSelectedId (1);
    }
    //[/Constructor]
}
コード例 #8
0
bool RVPFile::msnftp() {
	bool error = false;
	while (!completed) {
		char *params = "";
		char *line = connection->recvLine();
		if (line != NULL && strlen(line) > 2) {
			if (strlen(line) > 3) {
				params = line + 4;
			}
			int command = (int)line[0] | (((int)line[1]) << 8) | (((int)line[2]) << 16);
			command = (command&0x00FFFFFF)|0x20000000;
			switch (command) {
				case ' REV':
					{
						char protocol[7];
						bool msnftp = false;
						while (params != NULL && sscanf(params, "%6s", protocol) >= 1) {
							if (strcmp(protocol, "MSNFTP") == 0) {
								msnftp = true;
								break;
							}
							params = strstr(params, " ");
							if (params != NULL) params ++;
						}
						if (getMode() == RVPFile::MODE_SEND) {
							connection->send("VER MSNFTP\r\n");
						} else {
							if (msnftp) {
								connection->sendText("USR %s %s\r\n",getLogin(),getAuthCookie());
							} else {
								/* error */
							}
						}
					}
					break;
				case ' RSU':
					{
						char email[130], cookie[14];
						if (sscanf(params,"%129s %13s",email, cookie) >= 2) {
							if (!strcmp(email, getLogin()) && !strcmp(cookie, getAuthCookie())) {
								connection->sendText("FIL %i\r\n", getSize());
							} else {
								/* error */
							}
							break;
						}
					}
					break;
				case ' LIF':
					{
						char filesize[ 30 ];
						if ( sscanf( params, "%s", filesize ) >= 1 ) {
							setSize(atol(filesize));
							connection->send("TFR\r\n");
							/* ack initializing */
							if (listener != NULL) {
								listener->onFileProgress(this, RVPFileListener::PROGRESS_INITIALIZING, 0);
							}
							/* receive data */
							int fileId = _open(getPath(), _O_BINARY|_O_WRONLY|_O_CREAT|_O_TRUNC, _S_IREAD|_S_IWRITE);
							error = false;
							if (fileId >= 0) {
								int bytesToReceive = getSize();
								while (!error && bytesToReceive > 0) {
									char buffer[2048];
									int header = 0;
									if (connection->recv((char *)&header, 3)) {
										int blockSize = header >> 8;
										while (!error && blockSize > 0) {
											error = true;
											int readSize = min(2048, blockSize);
											if (connection->recv(buffer, readSize)) {
												blockSize -= readSize;
												bytesToReceive -= readSize;
												if (_write(fileId, buffer, readSize) == readSize) {
													error = false;
												}
											}
										}
										if (listener != NULL) {
											listener->onFileProgress(this, RVPFileListener::PROGRESS_PROGRESS, getSize() - bytesToReceive);
										}
										if (header&0xFF != 0) {
											break;
										}
									} else {
										error = true;
									}
								}
								_close(fileId);
							} else {
								error = true;
							}
							completed = true;
						}
コード例 #9
0
ファイル: Slider.cpp プロジェクト: sureandrew/stuntrally
//  update track on resize
void Slider::setSize(int _width, int _height)
{
    setSize(IntSize(_width, _height));
}
コード例 #10
0
//==============================================================================
Threshold::Threshold ()
    : Component (L"Threshold"),
      groupComponent (0),
      threshold_levelslider (0),
      label (0),
      textButton (0),
      toggleButton (0),
      resetbutton (0),
      label2 (0),
      textButton2 (0)
{
    addAndMakeVisible (groupComponent = new GroupComponent (L"new group",
                                                            L"Threshold"));
    groupComponent->setTextLabelPosition (Justification::centredLeft);
    groupComponent->setColour (GroupComponent::outlineColourId, Colour (0xb0000000));

    addAndMakeVisible (threshold_levelslider = new Slider (L"new slider"));
    threshold_levelslider->setRange (0, 10, 0);
    threshold_levelslider->setSliderStyle (Slider::LinearHorizontal);
    threshold_levelslider->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20);
    threshold_levelslider->setColour (Slider::backgroundColourId, Colour (0x956565));
    threshold_levelslider->setColour (Slider::thumbColourId, Colour (0x6efffcfc));
    threshold_levelslider->setColour (Slider::textBoxBackgroundColourId, Colour (0xffffff));
    threshold_levelslider->addListener (this);

    addAndMakeVisible (label = new Label (L"new label",
                                          L"Threshold level (0-10)"));
    label->setFont (Font (15.0000f, Font::plain));
    label->setJustificationType (Justification::centredLeft);
    label->setEditable (false, false, false);
    label->setColour (Label::backgroundColourId, Colour (0x0));
    label->setColour (Label::textColourId, Colours::black);
    label->setColour (Label::outlineColourId, Colour (0x0));
    label->setColour (TextEditor::textColourId, Colours::black);
    label->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (textButton = new TextButton (L"new button"));
    textButton->setButtonText (L"Do it!");
    textButton->addListener (this);
    textButton->setColour (TextButton::buttonColourId, Colour (0x40bbbbff));

    addAndMakeVisible (toggleButton = new ToggleButton (L"new toggle button"));
    toggleButton->setButtonText (L"Remove above threshold");
    toggleButton->addListener (this);

    addAndMakeVisible (resetbutton = new TextButton (L"resetbutton"));
    resetbutton->setButtonText (L"reset");
    resetbutton->addListener (this);
    resetbutton->setColour (TextButton::buttonColourId, Colour (0x3bbbbbff));

    addAndMakeVisible (label2 = new Label (L"new label",
                                           L"Removes all partials below a given amplitude threshold."));
    label2->setFont (Font (15.0000f, Font::plain));
    label2->setJustificationType (Justification::centredLeft);
    label2->setEditable (false, false, false);
    label2->setColour (Label::backgroundColourId, Colour (0x0));
    label2->setColour (Label::textColourId, Colours::black);
    label2->setColour (Label::outlineColourId, Colour (0x0));
    label2->setColour (TextEditor::textColourId, Colours::black);
    label2->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (textButton2 = new TextButton (L"new button"));
    textButton2->setButtonText (L"Redo it!");
    textButton2->addListener (this);
    textButton2->setColour (TextButton::buttonColourId, Colour (0x40bbbbff));


    //[UserPreSize]
    //[/UserPreSize]

    setSize (600, 400);


    //[Constructor] You can add your own custom stuff here..
    buttonClicked(resetbutton);
#undef Slider
    //[/Constructor]
}
コード例 #11
0
void PNGImageDecoder::headerAvailable()
{
    png_structp png = m_reader->pngPtr();
    png_infop info = m_reader->infoPtr();
    png_uint_32 width = png_get_image_width(png, info);
    png_uint_32 height = png_get_image_height(png, info);

    // Protect against large PNGs. See http://bugzil.la/251381 for more details.
    const unsigned long maxPNGSize = 1000000UL;
    if (width > maxPNGSize || height > maxPNGSize) {
        longjmp(JMPBUF(png), 1);
        return;
    }

    // Set the image size now that the image header is available.
    if (!setSize(width, height)) {
        longjmp(JMPBUF(png), 1);
        return;
    }

    int bitDepth, colorType, interlaceType, compressionType, filterType, channels;
    png_get_IHDR(png, info, &width, &height, &bitDepth, &colorType, &interlaceType, &compressionType, &filterType);

    // The options we set here match what Mozilla does.

    // Expand to ensure we use 24-bit for RGB and 32-bit for RGBA.
    if (colorType == PNG_COLOR_TYPE_PALETTE || (colorType == PNG_COLOR_TYPE_GRAY && bitDepth < 8))
        png_set_expand(png);

    png_bytep trns = 0;
    int trnsCount = 0;
    if (png_get_valid(png, info, PNG_INFO_tRNS)) {
        png_get_tRNS(png, info, &trns, &trnsCount, 0);
        png_set_expand(png);
    }

    if (bitDepth == 16)
        png_set_strip_16(png);

    if (colorType == PNG_COLOR_TYPE_GRAY || colorType == PNG_COLOR_TYPE_GRAY_ALPHA)
        png_set_gray_to_rgb(png);

#if USE(QCMSLIB)
    if ((colorType & PNG_COLOR_MASK_COLOR) && !m_ignoreGammaAndColorProfile) {
        // We only support color profiles for color PALETTE and RGB[A] PNG. Supporting
        // color profiles for gray-scale images is slightly tricky, at least using the
        // CoreGraphics ICC library, because we expand gray-scale images to RGB but we
        // do not similarly transform the color profile. We'd either need to transform
        // the color profile or we'd need to decode into a gray-scale image buffer and
        // hand that to CoreGraphics.
        bool sRGB = false;
        ColorProfile colorProfile;
        getColorProfile(png, info, colorProfile, sRGB);
        bool imageHasAlpha = (colorType & PNG_COLOR_MASK_ALPHA) || trnsCount;
        m_reader->createColorTransform(colorProfile, imageHasAlpha, sRGB);
        m_hasColorProfile = !!m_reader->colorTransform();
    }
#endif

    if (!m_hasColorProfile) {
        // Deal with gamma and keep it under our control.
        const double inverseGamma = 0.45455;
        const double defaultGamma = 2.2;
        double gamma;
        if (!m_ignoreGammaAndColorProfile && png_get_gAMA(png, info, &gamma)) {
            const double maxGamma = 21474.83;
            if ((gamma <= 0.0) || (gamma > maxGamma)) {
                gamma = inverseGamma;
                png_set_gAMA(png, info, gamma);
            }
            png_set_gamma(png, defaultGamma, gamma);
        } else {
            png_set_gamma(png, defaultGamma, inverseGamma);
        }
    }

    // Tell libpng to send us rows for interlaced pngs.
    if (interlaceType == PNG_INTERLACE_ADAM7)
        png_set_interlace_handling(png);

    // Update our info now.
    png_read_update_info(png, info);
    channels = png_get_channels(png, info);
    ASSERT(channels == 3 || channels == 4);

    m_reader->setHasAlpha(channels == 4);

    if (m_reader->decodingSizeOnly()) {
        // If we only needed the size, halt the reader.
#if PNG_LIBPNG_VER_MAJOR > 1 || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 5)
        // '0' argument to png_process_data_pause means: Do not cache unprocessed data.
        m_reader->setReadOffset(m_reader->currentBufferSize() - png_process_data_pause(png, 0));
#else
        m_reader->setReadOffset(m_reader->currentBufferSize() - png->buffer_size);
        png->buffer_size = 0;
#endif
    }
}
コード例 #12
0
ファイル: Spike.cpp プロジェクト: kulgan/playn-greengrappler
Spike::Spike()
: mSpikeTile(Resource::getBitmap("data/images/tileset1.bmp"), 70, 0, 10, 10)
{
	setSize(float2(10,10));
}
コード例 #13
0
//==============================================================================
AudioDemoPlaybackPage::AudioDemoPlaybackPage (AudioDeviceManager& deviceManager_)
    : deviceManager (deviceManager_),
      thread ("audio file preview"),
      directoryList (0, thread),
      zoomLabel (0),
      thumbnail (0),
      startStopButton (0),
      fileTreeComp (0),
      explanation (0),
      zoomSlider (0)
{
    addAndMakeVisible (zoomLabel = new Label (String::empty,
                                              L"zoom:"));
    zoomLabel->setFont (Font (15.0000f, Font::plain));
    zoomLabel->setJustificationType (Justification::centredRight);
    zoomLabel->setEditable (false, false, false);
    zoomLabel->setColour (TextEditor::textColourId, Colours::black);
    zoomLabel->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (explanation = new Label (String::empty,
                                                L"Select an audio file in the treeview above, and this page will display its waveform, and let you play it.."));
    explanation->setFont (Font (14.0000f, Font::plain));
    explanation->setJustificationType (Justification::bottomRight);
    explanation->setEditable (false, false, false);
    explanation->setColour (TextEditor::textColourId, Colours::black);
    explanation->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (zoomSlider = new Slider (String::empty));
    zoomSlider->setRange (0, 1, 0);
    zoomSlider->setSliderStyle (Slider::LinearHorizontal);
    zoomSlider->setTextBoxStyle (Slider::NoTextBox, false, 80, 20);
    zoomSlider->addListener (this);
    zoomSlider->setSkewFactor (2);

    addAndMakeVisible (thumbnail = new DemoThumbnailComp (formatManager, transportSource, *zoomSlider));

    addAndMakeVisible (startStopButton = new TextButton (String::empty));
    startStopButton->setButtonText (L"Play/Stop");
    startStopButton->addListener (this);
    startStopButton->setColour (TextButton::buttonColourId, Colour (0xff79ed7f));

    addAndMakeVisible (fileTreeComp = new FileTreeComponent (directoryList));

    //[UserPreSize]
    //[/UserPreSize]

    setSize (600, 400);


    //[Constructor] You can add your own custom stuff here..
    formatManager.registerBasicFormats();

    directoryList.setDirectory (File::getSpecialLocation (File::userHomeDirectory), true, true);
    thread.startThread (3);

    fileTreeComp->setColour (FileTreeComponent::backgroundColourId, Colours::white);
    fileTreeComp->addListener (this);

    deviceManager.addAudioCallback (&audioSourcePlayer);
    audioSourcePlayer.setSource (&transportSource);
    //[/Constructor]
}
コード例 #14
0
//==============================================================================
PluginEditor::PluginEditor (PluginProcessor& p)
    : AudioProcessorEditor (&p),
      buttonAB ("A-B"),
      buttonCopyAB ("Copy"),
      backgroundImage {ImageCache::getFromMemory (BinaryData::BalanceWidth_02fs8_png,
                                                  BinaryData::BalanceWidth_02fs8_pngSize)},
      knobStyleImage  {ImageCache::getFromMemory (BinaryData::knob05LargeForeground4fs8_png,
                                                  BinaryData::knob05LargeForeground4fs8_pngSize)},
      filmstripImage  {ImageCache::getFromMemory (BinaryData::markerFilmstripfs8_png,
                                                  BinaryData::markerFilmstripfs8_pngSize)},
      processor (p)
{
    // Button AB
    buttonAB.setColour (TextButton::textColourOffId, Colour (0xff373737));
    buttonAB.setColour (TextButton::buttonColourId, Colour (0xff808080));
    addAndMakeVisible (buttonAB);
    buttonAB.addListener (this);

    // Button copy
    buttonCopyAB.setColour (TextButton::textColourOffId, Colour (0xff373737));
    buttonCopyAB.setColour (TextButton::buttonColourId, Colour (0xff808080));
    addAndMakeVisible (buttonCopyAB);
    buttonCopyAB.addListener (this);

    // StepSize slider
    String stepSizeParamName = processor.getParam(0).name;                     // magic constant!

    Slider* stepSizeSlider = new Slider (stepSizeParamName);
    jassert (stepSizeSlider);
    sliders.add (stepSizeSlider);

    stepSizeSlider->setSliderStyle (Slider::LinearHorizontal);
    stepSizeSlider->setTextBoxStyle (Slider::TextBoxLeft,false,60,15);         // magic constants!
    stepSizeSlider->setColour (Slider::textBoxTextColourId,       Colour (0xff373737));
    stepSizeSlider->setColour (Slider::textBoxBackgroundColourId, Colour (0xff707070));
    stepSizeSlider->setColour (Slider::textBoxHighlightColourId,  Colour (0xffffffff));
    stepSizeSlider->setColour (Slider::textBoxOutlineColourId,    Colour (0x00000000));

    addAndMakeVisible (stepSizeSlider);
    stepSizeSlider->addListener (this);

    // StepSize label
    Label* stepSizeLabel = new Label (stepSizeParamName, stepSizeParamName);
    jassert (stepSizeLabel);
    labels.add (stepSizeLabel);

    stepSizeLabel->setJustificationType (Justification::centredLeft);
    stepSizeLabel->setEditable (false, false, false);
    stepSizeLabel->setColour (Label::textColourId, Colour (0xff2b2b2b));

    addAndMakeVisible (stepSizeLabel);

    // Main knob
    knob = new FilmStrip {filmstripImage, knobStyleImage};

    sliders.add (knob);

    knob->setDoubleClickReturnValue (true, sliders[0]->getValue()); // current getValue() is
                                                                    // the default value (0dB)

    addAndMakeVisible (knob);
    knob->addListener (this);

    // Init and size setting
    updateSlidersFromProcParams();  // set slider values and ranges

    setSize (400, 400);             // must be set before xtor finished

    startTimerHz (30);
}
コード例 #15
0
ファイル: image.cpp プロジェクト: aeliot/MuseScore
void Image::setScale(const QSizeF& scale)
      {
      setSize(sizeForScale(scale));
      }
コード例 #16
0
void PNGImageDecoder::headerAvailable()
{
    png_structp png = m_reader->pngPtr();
    png_infop info = m_reader->infoPtr();
    png_uint_32 width = png->width;
    png_uint_32 height = png->height;
    
    // Protect against large images.
    if (png->width > cMaxPNGSize || png->height > cMaxPNGSize) {
        longjmp(png->jmpbuf, 1);
        return;
    }
    
    // We can fill in the size now that the header is available.  Avoid memory
    // corruption issues by neutering setFailed() during this call; if we don't
    // do this, failures will cause |m_reader| to be deleted, and our jmpbuf
    // will cease to exist.  Note that we'll still properly set the failure flag
    // in this case as soon as we longjmp().
    m_doNothingOnFailure = true;
    bool result = setSize(width, height);
    m_doNothingOnFailure = false;
    if (!result) {
        longjmp(png->jmpbuf, 1);
        return;
    }

    int bitDepth, colorType, interlaceType, compressionType, filterType, channels;
    png_get_IHDR(png, info, &width, &height, &bitDepth, &colorType, &interlaceType, &compressionType, &filterType);

    // The options we set here match what Mozilla does.

    // Expand to ensure we use 24-bit for RGB and 32-bit for RGBA.
    if (colorType == PNG_COLOR_TYPE_PALETTE || (colorType == PNG_COLOR_TYPE_GRAY && bitDepth < 8))
        png_set_expand(png);
    
    png_bytep trns = 0;
    int trnsCount = 0;
    if (png_get_valid(png, info, PNG_INFO_tRNS)) {
        png_get_tRNS(png, info, &trns, &trnsCount, 0);
        png_set_expand(png);
    }

    if (bitDepth == 16)
        png_set_strip_16(png);

    if (colorType == PNG_COLOR_TYPE_GRAY || colorType == PNG_COLOR_TYPE_GRAY_ALPHA)
        png_set_gray_to_rgb(png);

    // Deal with gamma and keep it under our control.
    double gamma;
    if (png_get_gAMA(png, info, &gamma)) {
        if ((gamma <= 0.0) || (gamma > cMaxGamma)) {
            gamma = cInverseGamma;
            png_set_gAMA(png, info, gamma);
        }
        png_set_gamma(png, cDefaultGamma, gamma);
    } else
        png_set_gamma(png, cDefaultGamma, cInverseGamma);

    // Tell libpng to send us rows for interlaced pngs.
    if (interlaceType == PNG_INTERLACE_ADAM7)
        png_set_interlace_handling(png);

    // Update our info now.
    png_read_update_info(png, info);
    channels = png_get_channels(png, info);
    ASSERT(channels == 3 || channels == 4);

    m_reader->setHasAlpha(channels == 4);

    if (m_reader->decodingSizeOnly()) {
        // If we only needed the size, halt the reader.     
        m_reader->setReadOffset(m_reader->currentBufferSize() - png->buffer_size);
        png->buffer_size = 0;
    }
}
コード例 #17
0
//==============================================================================
DerivativeAmp::DerivativeAmp ()
    : Component (T("DerivativeAmp")),
      groupComponent (0),
      amp_derivate_multiplierslider (0),
      label (0),
      textButton (0),
      resetbutton (0),
      label2 (0),
      textButton2 (0)
{
    addAndMakeVisible (groupComponent = new GroupComponent (T("new group"),
                                                            T("Derivate Amp")));
    groupComponent->setTextLabelPosition (Justification::centredLeft);
    groupComponent->setColour (GroupComponent::outlineColourId, Colour (0xb0000000));

    addAndMakeVisible (amp_derivate_multiplierslider = new Slider (T("new slider")));
    amp_derivate_multiplierslider->setRange (-5, 5, 0);
    amp_derivate_multiplierslider->setSliderStyle (Slider::LinearHorizontal);
    amp_derivate_multiplierslider->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20);
    amp_derivate_multiplierslider->setColour (Slider::backgroundColourId, Colour (0x956565));
    amp_derivate_multiplierslider->setColour (Slider::thumbColourId, Colour (0x7dfffcfc));
    amp_derivate_multiplierslider->setColour (Slider::textBoxBackgroundColourId, Colour (0xffffff));
    amp_derivate_multiplierslider->addListener (this);

    addAndMakeVisible (label = new Label (T("new label"),
                                          T("Amp derivate multiplier (-5 5)")));
    label->setFont (Font (15.0000f, Font::plain));
    label->setJustificationType (Justification::centredLeft);
    label->setEditable (false, false, false);
    label->setColour (Label::backgroundColourId, Colour (0x0));
    label->setColour (Label::textColourId, Colours::black);
    label->setColour (Label::outlineColourId, Colour (0x0));
    label->setColour (TextEditor::textColourId, Colours::black);
    label->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (textButton = new TextButton (T("new button")));
    textButton->setButtonText (T("Do it!"));
    textButton->addButtonListener (this);
    textButton->setColour (TextButton::buttonColourId, Colour (0x39bbbbff));

    addAndMakeVisible (resetbutton = new TextButton (T("resetbutton")));
    resetbutton->setButtonText (T("reset"));
    resetbutton->addButtonListener (this);
    resetbutton->setColour (TextButton::buttonColourId, Colour (0x42bbbbff));

    addAndMakeVisible (label2 = new Label (T("new label"),
                                           T("Replaces the amplitude spectrum with its derivative (slope). You may specify a gain factor.\n")));
    label2->setFont (Font (15.0000f, Font::plain));
    label2->setJustificationType (Justification::centredLeft);
    label2->setEditable (false, false, false);
    label2->setColour (Label::backgroundColourId, Colour (0x0));
    label2->setColour (Label::textColourId, Colours::black);
    label2->setColour (Label::outlineColourId, Colour (0x0));
    label2->setColour (TextEditor::textColourId, Colours::black);
    label2->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (textButton2 = new TextButton (T("new button")));
    textButton2->setButtonText (T("Redo it!"));
    textButton2->addButtonListener (this);
    textButton2->setColour (TextButton::buttonColourId, Colour (0x40bbbbff));

    setSize (600, 400);

    //[Constructor] You can add your own custom stuff here..
    buttonClicked(resetbutton);
#undef Slider
    //[/Constructor]
}
コード例 #18
0
ファイル: page.cpp プロジェクト: MatthewStein/MuseScore
void PageFormat::read(XmlReader& e, Score* score)
      {
      qreal _oddRightMargin  = 0.0;
      qreal _evenRightMargin = 0.0;
      bool landscape = false;
      QString type;

      while (e.readNextStartElement()) {
            const QStringRef& tag(e.name());
            if (tag == "pageFormat")            // obsolete
                  setSize(getPaperSize(e.readElementText()));
            else if (tag == "landscape")        // obsolete
                  landscape = e.readInt();
            else if (tag == "page-margins") {
                  type = e.attribute("type","both");
                  qreal lm = 0.0, rm = 0.0, tm = 0.0, bm = 0.0;
                  while (e.readNextStartElement()) {
                        const QStringRef& tag(e.name());
                        qreal val = e.readDouble() * 0.5 / PPI;
                        if (tag == "left-margin")
                              lm = val;
                        else if (tag == "right-margin")
                              rm = val;
                        else if (tag == "top-margin")
                              tm = val;
                        else if (tag == "bottom-margin")
                              bm = val;
                        else
                              e.unknown();
                        }
                  _twosided = type == "odd" || type == "even";
                  if (type == "odd" || type == "both") {
                        _oddLeftMargin   = lm;
                        _oddRightMargin  = rm;
                        _oddTopMargin    = tm;
                        _oddBottomMargin = bm;
                        }
                  if (type == "even" || type == "both") {
                        _evenLeftMargin   = lm;
                        _evenRightMargin  = rm;
                        _evenTopMargin    = tm;
                        _evenBottomMargin = bm;
                        }
                  }
            else if (tag == "page-height")
                  _size.rheight() = e.readDouble() * 0.5 / PPI;
            else if (tag == "page-width")
                  _size.rwidth() = e.readDouble() * .5 / PPI;
            else if (tag == "page-offset") {           // obsolete, moved to Score
                  QString val(e.readElementText());
                  if(score)
                        score->setPageNumberOffset(val.toInt());
                  }
            else
                  e.unknown();
            }
      if (landscape)
            _size.transpose();
      qreal w1 = _size.width() - _oddLeftMargin - _oddRightMargin;
      qreal w2 = _size.width() - _evenLeftMargin - _evenRightMargin;
      _printableWidth = qMax(w1, w2);     // silently adjust right margins
      }
コード例 #19
0
ファイル: pht.cpp プロジェクト: mAarnos/Hakkapeliitta
PawnHashTable::PawnHashTable()
{
    setSize(4); 
}
コード例 #20
0
void PseudoStateCanvas::menu(const QPoint&) {
  Q3PopupMenu m(0);
  Q3PopupMenu toolm(0);
  int index;
    
  MenuFactory::createTitle(m, browser_node->get_data()->definition(FALSE, TRUE));
  m.insertSeparator();
  m.insertItem(TR("Upper"), 0);
  m.insertItem(TR("Lower"), 1);
  m.insertItem(TR("Go up"), 13);
  m.insertItem(TR("Go down"), 14);
  m.insertSeparator();
  switch (browser_node->get_type()) {
  case ForkPS:
  case JoinPS:
    m.insertItem((horiz) ? TR("draw vertically") : TR("draw horizontally"), 2);
    m.insertSeparator();
    break;
  default:
    break;
  }
  /*m.insertItem("Edit drawing settings", 2);
  m.insertSeparator();*/
  m.insertItem(TR("Edit pseudo state"), 3);
  m.insertSeparator();
  m.insertItem(TR("Select in browser"), 4);
  if (linked())
    m.insertItem(TR("Select linked items"), 5);
  m.insertSeparator();
  /*if (browser_node->is_writable())
    if (browser_node->get_associated() !=
	(BrowserNode *) the_canvas()->browser_diagram())
      m.insertItem(TR("Set associated diagram"),6);
  m.insertSeparator();*/
  m.insertItem(TR("Remove from diagram"), 7);
  if (browser_node->is_writable())
    m.insertItem(TR("Delete from model"), 8);
  m.insertSeparator();
  if (Tool::menu_insert(&toolm, browser_node->get_type(), 20))
    m.insertItem(TR("Tool"), &toolm);
  
  switch (index = m.exec(QCursor::pos())) {
  case 0:
    upper();
    modified();	// call package_modified()
    return;
  case 1:
    lower();
    modified();	// call package_modified()
    return;
  case 13:
    z_up();
    modified();	// call package_modified()
    return;
  case 14:
    z_down();
    modified();	// call package_modified()
    return;
  case 2:
    horiz ^= TRUE;
    if (!manual_size)
      set_xpm();
    else {
      setSize(height(), width());
      DiagramCanvas::resize(width(), height());
    }
    modified();	// call package_modified()
    return;
  case 3:
    browser_node->open(TRUE);
    return;
  case 4:
    browser_node->select_in_browser();
    return;
  case 5:
    the_canvas()->unselect_all();
    select_associated();
    return;
  case 7:
    //remove from diagram
    delete_it();
    break;
  case 8:
    //delete from model
    browser_node->delete_it();	// will delete the canvas
    break;
  default:
    if (index >= 20)
      ToolCom::run(Tool::command(index - 20), browser_node);
    return;
  }
  
  package_modified();
}
コード例 #21
0
//==============================================================================
MappingsDialog::MappingsDialog (MidiMappingManager *manager, OscMappingManager *manager2, AudioProcessorGraph::Node *plugin, Array<Mapping *> maps, PluginField *field)
    : mappingsList (0),
      addMidiButton (0),
      addOscButton (0),
      deleteButton (0),
      overrideMidiButton (0),
      oscMidiAddressLabel (0),
      oscMidiAddress (0),
      oscHintLabel (0)
{
    addAndMakeVisible (mappingsList = new ListBox (String::empty, this));
    mappingsList->setName (L"mappingsList");

    addAndMakeVisible (addMidiButton = new TextButton (L"addMidiButton"));
    addMidiButton->setButtonText (L"add MIDI");
    addMidiButton->addListener (this);

    addAndMakeVisible (addOscButton = new TextButton (L"addOscButton"));
    addOscButton->setButtonText (L"add OSC");
    addOscButton->addListener (this);

    addAndMakeVisible (deleteButton = new TextButton (L"deleteButton"));
    deleteButton->setButtonText (L"remove");
    deleteButton->addListener (this);

    addAndMakeVisible (overrideMidiButton = new ToggleButton (L"overrideMidiButton"));
    overrideMidiButton->setButtonText (L"Override plugin\'s default MIDI behaviour");
    overrideMidiButton->addListener (this);

    addAndMakeVisible (oscMidiAddressLabel = new Label (L"oscMidiAddressLabel",
                                                        L"OSC MIDI Address:"));
    oscMidiAddressLabel->setFont (Font (15.0000f, Font::plain));
    oscMidiAddressLabel->setJustificationType (Justification::centredLeft);
    oscMidiAddressLabel->setEditable (false, false, false);
    oscMidiAddressLabel->setColour (TextEditor::textColourId, Colours::black);
    oscMidiAddressLabel->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (oscMidiAddress = new TextEditor (L"oscMidiAddress"));
    oscMidiAddress->setMultiLine (false);
    oscMidiAddress->setReturnKeyStartsNewLine (false);
    oscMidiAddress->setReadOnly (false);
    oscMidiAddress->setScrollbarsShown (true);
    oscMidiAddress->setCaretVisible (true);
    oscMidiAddress->setPopupMenuEnabled (true);
    oscMidiAddress->setText (String::empty);

    addAndMakeVisible (oscHintLabel = new Label (L"oscHintLabel",
                                                 L"(leave blank if you don\'t want to receive MIDI over OSC)"));
    oscHintLabel->setFont (Font (15.0000f, Font::plain));
    oscHintLabel->setJustificationType (Justification::centredRight);
    oscHintLabel->setEditable (false, false, false);
    oscHintLabel->setColour (Label::textColourId, Colours::black);
    oscHintLabel->setColour (TextEditor::textColourId, Colours::black);
    oscHintLabel->setColour (TextEditor::backgroundColourId, Colour (0x0));


    //[UserPreSize]
	midiManager = manager;
	oscManager = manager2;
	pluginNode = plugin;
	mappings = maps;
	pluginField = field;

	mappingsList->updateContent();
	mappingsList->setOutlineThickness(1);
	mappingsList->setColour(ListBox::outlineColourId, Colour(0x60000000));
	mappingsList->setRowHeight(40);
	mappingsList->setMouseClickGrabsKeyboardFocus(true);
	mappingsList->setWantsKeyboardFocus(true);
	mappingsList->setColour(ListBox::backgroundColourId,
							ColourScheme::getInstance().colours[L"Dialog Inner Background"]);

	overrideMidiButton->setToggleState(!pluginField->getMidiEnabledForNode(pluginNode), false);

	{
		BypassableInstance *proc = dynamic_cast<BypassableInstance *>(pluginNode->getProcessor());

		if(proc)
			oscMidiAddress->setText(oscManager->getMIDIProcessorAddress(proc));
	}
	oscMidiAddress->addListener(this);
    //[/UserPreSize]

    setSize (738, 400);


    //[Constructor] You can add your own custom stuff here..
    //[/Constructor]
}
コード例 #22
0
ファイル: GuiControl.cpp プロジェクト: luaman/g3d-cvs
void GuiControl::setSize(float x, float y) {
    setSize(Vector2(x, y));
}
コード例 #23
0
void PHIContext2D::setSize( const QSize &size )
{
    setSize( size.width(), size.height() );
}
コード例 #24
0
ファイル: pMixGraphEditorParts.cpp プロジェクト: eriser/pMix2
void FilterComponent::update()
{
  const AudioProcessorGraph::Node::Ptr f (audioEngine.getDoc().getNodeForId (nodeId));
  
  if (f == nullptr)
  {
    delete this;
    return;
  }

  numIns = f->getProcessor()->getTotalNumInputChannels();
  if (f->getProcessor()->acceptsMidi())
    ++numIns;
  
  numOuts = f->getProcessor()->getTotalNumOutputChannels();
  if (f->getProcessor()->producesMidi())
    ++numOuts;
  
  FaustAudioPluginInstance* faustProc = dynamic_cast<FaustAudioPluginInstance*>(f->getProcessor());
  
  if (faustProc)
    highlight = faustProc->getHighlight();

  int w = 10;
  int h = 50;

  // Update width based on number of I/O
  w = jmax (w, PINS_LEFT_OFFSET + ((jmax (numIns, numOuts) + 1) * OFFSET_BETWEEN_PINS));
  
  String name = f->getProcessor()->getName();
  
  setName (name);

  if (numIns != numInputs || numOuts != numOutputs || editor == nullptr)
  {
    numInputs = numIns;
    numOutputs = numOuts;
    
    deleteAllChildren();
    
    addAndMakeVisible(filterName = new Label(name, name));
    filterName->setJustificationType(Justification::centred);
    filterName->setInterceptsMouseClicks(false, false);
    filterName->setFont(font);
    
    w = jmax (w, filterName->getFont().getStringWidth(name) + 15);
  
    if(!InternalPluginFormat::isInternalFormat(name) && f->getProcessor()->getNumParameters() > 0)
    {
      addAndMakeVisible(editor = new PMixGenericAudioProcessorEditor (audioEngine, f->getProcessor(), f->nodeId));
      w = jmax (w, editor->getWidth() + 20 );
      
      if (editor->getContentHeight() > 300) {
        editor->setSize(editor->getWidth(), 100);
      }
      
      h += jmin (320, editor->getContentHeight() + 20);
    }
    
    setSize (w, h);

    int i;
    for (i = 0; i < f->getProcessor()->getTotalNumInputChannels(); ++i)
      addAndMakeVisible (new PinComponent (audioEngine, nodeId, i, true));
    
    if (f->getProcessor()->acceptsMidi())
      addAndMakeVisible (new PinComponent (audioEngine, nodeId, PMixDocument::midiChannelNumber, true));
    
    for (i = 0; i < f->getProcessor()->getTotalNumOutputChannels(); ++i)
      addAndMakeVisible (new PinComponent (audioEngine, nodeId, i, false));
    
    if (f->getProcessor()->producesMidi())
      addAndMakeVisible (new PinComponent (audioEngine, nodeId, PMixDocument::midiChannelNumber, false));
    
    resized();
  }
  
  {
    double x, y;
    audioEngine.getDoc().getNodePosition (nodeId, x, y);
    setCentreRelative ((float) x, (float) y);
  }
}
コード例 #25
0
//==============================================================================
CtrlrMIDISettingsRouting::CtrlrMIDISettingsRouting (CtrlrPanel &_owner)
    : owner(_owner)
{
    //[Constructor_pre] You can add your own custom stuff here..
    //[/Constructor_pre]

    addAndMakeVisible (groupComponent = new GroupComponent ("new group",
                                                            TRANS("THRU")));

    addAndMakeVisible (inDev2OutDev = new ToggleButton (String::empty));
    inDev2OutDev->setTooltip (TRANS("All messages that are received on the MIDI Input device will be copied to the selected output MIDI Device"));
    inDev2OutDev->setButtonText (TRANS("IN Device  -> OUT Device"));
    inDev2OutDev->addListener (this);

    addAndMakeVisible (ctrlDev2OutDev = new ToggleButton (String::empty));
    ctrlDev2OutDev->setTooltip (TRANS("All messages that are received on the MIDI Controller device will be copied to the selected output MIDI Device"));
    ctrlDev2OutDev->setButtonText (TRANS("CTRL Device -> OUT Device"));
    ctrlDev2OutDev->addListener (this);

    addAndMakeVisible (host2OutDev = new ToggleButton (String::empty));
    host2OutDev->setTooltip (TRANS("All messages received from the plugin HOST, will be copied to the MIDI Output device"));
    host2OutDev->setButtonText (TRANS("HOST -> OUT Device"));
    host2OutDev->addListener (this);

    addAndMakeVisible (host2Host = new ToggleButton (String::empty));
    host2Host->setTooltip (TRANS("All messages received from the plugin HOST, will be copied back to the plugin HOST"));
    host2Host->setButtonText (TRANS("HOST -> HOST"));
    host2Host->addListener (this);

    addAndMakeVisible (inDev2OutDevCh = new ToggleButton ("new toggle button"));
    inDev2OutDevCh->setButtonText (String::empty);
    inDev2OutDevCh->addListener (this);

    addAndMakeVisible (ctrlDev2OutDevCh = new ToggleButton ("new toggle button"));
    ctrlDev2OutDevCh->setButtonText (String::empty);
    ctrlDev2OutDevCh->addListener (this);

    addAndMakeVisible (host2OutDevCh = new ToggleButton ("new toggle button"));
    host2OutDevCh->setButtonText (String::empty);
    host2OutDevCh->addListener (this);

    addAndMakeVisible (host2HostCh = new ToggleButton ("new toggle button"));
    host2HostCh->setButtonText (String::empty);
    host2HostCh->addListener (this);

    addAndMakeVisible (label = new Label ("new label",
                                          TRANS("Change\n"
                                          "MIDI\n"
                                          "Channel")));
    label->setFont (Font (12.00f, Font::plain));
    label->setJustificationType (Justification::centred);
    label->setEditable (false, false, false);
    label->setColour (TextEditor::textColourId, Colours::black);
    label->setColour (TextEditor::backgroundColourId, Colour (0x00000000));

    addAndMakeVisible (inDev2Host = new ToggleButton (String::empty));
    inDev2Host->setTooltip (TRANS("All messages that are received on the MIDI Input device will be copied to the plugin HOST"));
    inDev2Host->setButtonText (TRANS("In Device -> Host"));
    inDev2Host->addListener (this);

    addAndMakeVisible (inDev2HostCh = new ToggleButton ("new toggle button"));
    inDev2HostCh->setButtonText (String::empty);
    inDev2HostCh->addListener (this);


    //[UserPreSize]
    //[/UserPreSize]

    setSize (400, 500);


    //[Constructor] You can add your own custom stuff here..
    inDev2OutDev->setToggleState(owner.getProperty(Ids::panelMidiThruD2D), dontSendNotification);
    ctrlDev2OutDev->setToggleState(owner.getProperty(Ids::panelMidiThruC2D), dontSendNotification);
    host2OutDev->setToggleState(owner.getProperty(Ids::panelMidiThruH2D), dontSendNotification);
    host2Host->setToggleState(owner.getProperty(Ids::panelMidiThruH2H), dontSendNotification);
    inDev2Host->setToggleState(owner.getProperty(Ids::panelMidiThruD2H), dontSendNotification);

    inDev2OutDevCh->setToggleState(owner.getProperty(Ids::panelMidiThruD2DChannelize), dontSendNotification);
    ctrlDev2OutDevCh->setToggleState(owner.getProperty(Ids::panelMidiThruC2DChannelize), dontSendNotification);
    host2OutDevCh->setToggleState(owner.getProperty(Ids::panelMidiThruH2DChannelize), dontSendNotification);
    host2HostCh->setToggleState(owner.getProperty(Ids::panelMidiThruH2HChannelize), dontSendNotification);
    inDev2HostCh->setToggleState(owner.getProperty(Ids::panelMidiThruD2HChannelize), dontSendNotification);
    //[/Constructor]
}
コード例 #26
0
ファイル: PNGImageDecoder.cpp プロジェクト: bearmingo/UI
void PNGImageDecoder::headerAvailable()
{
    png_structp png = m_reader->pngPtr();
    png_infop info = m_reader->infoPtr();
    png_uint_32 width = png_get_image_width(png, info);
    png_uint_32 height = png_get_image_height(png, info);

    // Protect against large images.
    if (width > cMaxPNGSize || height > cMaxPNGSize) {
        longjmp(JMPBUF(png), 1);
        return;
    }

    // We can fill in the size now that the header is available.  Avoid memory
    // corruption issues by neutering setFailed() during this call; if we don't
    // do this, failures will cause |m_reader| to be deleted, and our jmpbuf
    // will cease to exist.  Note that we'll still properly set the failure flag
    // in this case as soon as we longjmp().
    m_doNothingOnFailure = true;
    bool result = setSize(width, height);
    m_doNothingOnFailure = false;
    if (!result) {
        longjmp(JMPBUF(png), 1);
        return;
    }

    int bitDepth, colorType, interlaceType, compressionType, filterType, channels;
    png_get_IHDR(png, info, &width, &height, &bitDepth, &colorType, &interlaceType, &compressionType, &filterType);

    if ((colorType == PNG_COLOR_TYPE_RGB || colorType == PNG_COLOR_TYPE_RGB_ALPHA) && !m_ignoreGammaAndColorProfile) {
        // We currently support color profiles only for RGB and RGBA PNGs.  Supporting
        // color profiles for gray-scale images is slightly tricky, at least using the
        // CoreGraphics ICC library, because we expand gray-scale images to RGB but we
        // don't similarly transform the color profile.  We'd either need to transform
        // the color profile or we'd need to decode into a gray-scale image buffer and
        // hand that to CoreGraphics.
        readColorProfile(png, info, m_colorProfile);
    }

    // The options we set here match what Mozilla does.

    // Expand to ensure we use 24-bit for RGB and 32-bit for RGBA.
    if (colorType == PNG_COLOR_TYPE_PALETTE || (colorType == PNG_COLOR_TYPE_GRAY && bitDepth < 8))
        png_set_expand(png);

    png_bytep trns = 0;
    int trnsCount = 0;
    if (png_get_valid(png, info, PNG_INFO_tRNS)) {
        png_get_tRNS(png, info, &trns, &trnsCount, 0);
        png_set_expand(png);
    }

    if (bitDepth == 16)
        png_set_strip_16(png);

    if (colorType == PNG_COLOR_TYPE_GRAY || colorType == PNG_COLOR_TYPE_GRAY_ALPHA)
        png_set_gray_to_rgb(png);

    // Deal with gamma and keep it under our control.
    double gamma;
    if (!m_ignoreGammaAndColorProfile && png_get_gAMA(png, info, &gamma)) {
        if ((gamma <= 0.0) || (gamma > cMaxGamma)) {
            gamma = cInverseGamma;
            png_set_gAMA(png, info, gamma);
        }
        png_set_gamma(png, cDefaultGamma, gamma);
    } else
        png_set_gamma(png, cDefaultGamma, cInverseGamma);

    // Tell libpng to send us rows for interlaced pngs.
    if (interlaceType == PNG_INTERLACE_ADAM7)
        png_set_interlace_handling(png);

    // Update our info now.
    png_read_update_info(png, info);
    channels = png_get_channels(png, info);
    ASSERT(channels == 3 || channels == 4);

    m_reader->setHasAlpha(channels == 4);

    if (m_reader->decodingSizeOnly()) {
        // If we only needed the size, halt the reader.
#if defined(PNG_LIBPNG_VER_MAJOR) && defined(PNG_LIBPNG_VER_MINOR) && (PNG_LIBPNG_VER_MAJOR > 1 || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 5))
        // '0' argument to png_process_data_pause means: Do not cache unprocessed data.
        m_reader->setReadOffset(m_reader->currentBufferSize() - png_process_data_pause(png, 0));
#else
        m_reader->setReadOffset(m_reader->currentBufferSize() - png->buffer_size);
        png->buffer_size = 0;
#endif
    }
}
コード例 #27
0
ファイル: screenshot.cpp プロジェクト: amanuelg3/screenviewer
Screenshot::Screenshot(QString format, int w, int h)
{
    setSize(w, h);
    setFormat(format);
    screen = new QByteArray();
}
コード例 #28
0
ファイル: fe_listbox.hpp プロジェクト: thepro101/attract
	void setSize( int w, int h ) {return setSize(sf::Vector2f(w,h));};
コード例 #29
0
	Widget::Widget(const IntCoord& _coord, Align _align, const WidgetSkinInfoPtr _info, CroppedRectanglePtr _parent, const Ogre::String & _name) :
		CroppedRectangleInterface(IntCoord(_coord.point(), _info->getSize()), _align, _parent), // размер по скину
		mOwner(static_cast<Widget*>(_parent)),
		UserData(),
		mStateInfo(_info->getStateInfo()),
		mMaskPeekInfo(_info->getMask()),
		mText(null),
		mEnabled(true),
		mVisible(true),
		mAlpha(ALPHA_MIN),
		mColour(Ogre::ColourValue::White),
		mName(_name),
		mCountSharedOverlay(0)
	{
		// имя отсылателя сообщений
		mWidgetEventSender = this;

		// подсчитаываем колличество оверлеев для объединения
		for (VectorSubWidgetInfo::const_iterator iter =_info->getBasisInfo().begin(); iter!=_info->getBasisInfo().end(); iter ++) {
			if (SubWidgetManager::getInstance().isSharedOverlay(*iter)) mCountSharedOverlay++;
		}

		// загружаем кирпичики виджета
		size_t id = 0;
		for (VectorSubWidgetInfo::const_iterator iter =_info->getBasisInfo().begin(); iter!=_info->getBasisInfo().end(); iter ++) {
			addSubSkin(*iter, _info->getMaterial(), id);
		}

		// парсим свойства
		const MapString & param = _info->getParams();
		if (false == param.empty()) {
			MapString::const_iterator iter = param.find("FontName");
			if (iter != param.end()) setFontName(iter->second);
			iter = param.find("FontHeight");
			if (iter != param.end()) setFontHeight(utility::parseInt(iter->second));
			iter = param.find("NeedKey");
			if (iter != param.end()) setNeedKeyFocus(iter->second == "true");
			iter = param.find("AlignText");
			if (iter != param.end()) setTextAlign(SkinManager::getInstance().parseAlign(iter->second));
			iter = param.find("Colour");
			if (iter != param.end()) setColour(utility::parseColour(iter->second));
			iter = param.find("Pointer");
			if (iter != param.end()) mPointer = iter->second;
			iter = param.find("Show");
			if (iter != param.end()) {
				if (utility::parseBool(iter->second)) show();
				else hide();
			}
		}

		// этот стиль есть всегда, даже если создатель не хотел его
		setState("normal");
		setAlpha(ALPHA_MAX);
		// альфа отца
		//if ( (mParent != null) && (static_cast<WidgetPtr>(mParent)->getAlpha() != ALPHA_MAX) ) setAlpha(static_cast<WidgetPtr>(mParent)->getAlpha());

		// создаем детей
		const VectorChildSkinInfo& child = _info->getChild();
		for (VectorChildSkinInfo::const_iterator iter=child.begin(); iter!=child.end(); ++iter) {
			WidgetPtr widget = createWidgetT(iter->type, iter->skin, iter->coord, iter->align);
			widget->_setInternalString(iter->name);
			// заполняем UserString пропертями
			for (MapString::const_iterator prop=iter->params.begin(); prop!=iter->params.end(); ++prop) {
				widget->setUserString(prop->first, prop->second);
			}
		}

		// а вот теперь нормальный размер
		setSize(_coord.size());
	}
コード例 #30
0
ファイル: al_Buffer.hpp プロジェクト: LuaAV/LuaAV
	/// This will set both the size and capacity of the buffer to the requested 
	/// size. If the number is smaller than the current size the buffer is 
	/// truncated, otherwise the buffer is extended and new elements are
	/// default-constructed.
	void resize(int n){
		mElems.resize(n);
		setSize(n);
	}