Exemplo n.º 1
0
void SDraw::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx)
{
	sMakeTextGlyph g;
	g.font = font;
	g.color = White();
	g.angle = angle;
	g.draw = this;
	for(int i = 0; i < n; i++) {
		g.chr = text[i];
		LTIMING("Paint glyph");
		if(font.GetHeight() > 200) {
			int bn = font[g.chr] + font.GetLineHeight();
			for(g.yy = 0; g.yy < bn; g.yy += 32) {
				Image m;
				if(paintonly)
					m = MakeImagePaintOnly(g);
				else
					m = MakeImage(g);
				Point h = m.GetHotSpot();
				SysDrawImageOp(x - h.x, y + g.yy - h.y, m, m.GetSize(), ink);
			}
		}
		else {
			g.yy = Null;
			Image m;
			if(paintonly)
				m = MakeImagePaintOnly(g);
			else
				m = MakeImage(g);
			Point h = m.GetHotSpot();
			SysDrawImageOp(x - h.x, y - h.y, m, m.GetSize(), ink);
		}
		x += dx ? *dx++ : font[g.chr];
	}
}
Exemplo n.º 2
0
    void onOnceBeforeDraw() override {
        const SkVector vectors[] = { { 1, 0 }, { 0, 1 } };

        for (size_t i = 0; i < SK_ARRAY_COUNT(vectors); ++i) {
           auto& set = fSets.push_back();

           set.fVector = vectors[i];
           set.fImages.push_back() = MakeImage(vectors[i], SK_ColorGREEN);
           set.fScales.push_back() = 1;
           set.fImages.push_back() = MakeImage(vectors[i], SK_ColorRED);
           set.fScales.push_back() = kStretchFactor;
           set.fImages.push_back() = MakeImage(vectors[i], SK_ColorGREEN);
           set.fScales.push_back() = 1;
        }
    }
Exemplo n.º 3
0
void SDraw::DrawTextOp(int x, int y, int angle, const wchar *text, Font font, Color ink, int n, const int *dx)
{
	sMakeTextGlyph g;
	g.font = font;
	g.color = White();
	g.angle = angle;
	g.draw = this;
	for(int i = 0; i < n; i++) {
		g.chr = text[i];
		LTIMING("Paint glyph");
		if(font.GetHeight() > 200) {
			Point at(font[g.chr], font.GetLineHeight());
			int n = at.x + at.y;
			Size bandsz(2 * n, 32);
			for(int yy = 0; yy < n; yy += bandsz.cy) {
				Image m = RenderGlyph(Point(0, -yy), angle, g.chr, font, White(), bandsz);
				SysDrawImageOp(x, y + yy, m, m.GetSize(), ink);
			}
		}
		else {
			Image m = MakeImage(g);
			Point h = m.GetHotSpot();
			SysDrawImageOp(x - h.x, y - h.y, m, m.GetSize(), ink);
		}
		x += dx ? *dx++ : font[g.chr];
	}
}
Exemplo n.º 4
0
void CWndMapPartsGrp::SetMode(
	int nMode)		/* 0:マップ画像 1:影画像 */
{
	m_nMode = nMode;
	MakeImage (nMode);
	InvalidateRect (NULL);
}
Exemplo n.º 5
0
Image ImageOver(const Image& back, const Image& over)
{
	sImageAdd h;
	h.i1 = back;
	h.i2 = over;
	return MakeImage(h);
}
Exemplo n.º 6
0
// Exercise a particular combination of image format, type and internal
// texture format.
// Return true for success, false for failure.
bool
PixelFormatsTest::TestCombination(GLenum format, GLenum type, GLint intFormat)
{
	const int numComps = NumberOfComponentsInFormat(format);
	const int width = 16;
	const int height = 16;
	int colorPos[4];
	ComponentPositions(format, colorPos);

	for (int comp = 0; comp < numComps; comp++) {
		if (colorPos[comp] >= 0) {
			// make original/incoming image
			const int comp2 = colorPos[comp];
			GLubyte *image = MakeImage(width, height, format, type, comp2);

			// render with image (texture / glDrawPixels)
			bool ok = DrawImage(width, height, format, type, intFormat, image);

			if (ok) {
				// check rendering
				ok = CheckRendering(width, height, comp, format, intFormat);
			}

			delete [] image;

			if (!ok) {
				return false;
			}
		}
	}

	return true;
}
Exemplo n.º 7
0
BOOL SGNameDrag::OnDrawSolidDrag(CPoint ptOrigin, CDC* pDC)
{
	// If the dragged item's image doesn't exists then make it by rendering the item into
	// a bitmap with the same depth as the screen.
	if (TheBitmap == 0) TheBitmap = MakeImage();
	return BitmapDragInformation::OnDrawSolidDrag(ptOrigin, pDC);
}
Exemplo n.º 8
0
Image CachedSetColorKeepAlpha(const Image& img, Color color)
{
	sColorize m;
	m.img = img;
	m.color = color;
	return MakeImage(m);
}
Exemplo n.º 9
0
Image GetFileIcon(const char *path, bool dir, bool force, bool large, bool quick = false)
{
	FileIconMaker m;
	String ext = GetFileExt(path);
	m.exe = false;
	m.dir = false;
	m.file = path;
	m.large = large;
	if(force)
		m.exe = true;
	else
	if(dir) {
		m.dir = true;
		m.exe = true;
	}
	else
	if(ext == ".exe")
		m.exe = true;
	else
		m.file = "x." + ext;
	if(quick) {
		m.exe = false;
		m.file = "x." + ext;
	}
	return MakeImage(m);
}
Exemplo n.º 10
0
/** Make a mipmap in which each level is a different, solid color */
static void
MakeMipmap(void)
{
   static const GLubyte colors[12][3] = {
      {255, 0, 0},
      {0, 255, 0},
      {0, 0, 255},
      {0, 255, 255},
      {255, 0, 255},
      {255, 255, 0},
      {255, 0, 0},
      {0, 255, 0},
      {0, 0, 255},
      {0, 255, 255},
      {255, 0, 255},
      {255, 255, 0},
   };
   int i, sz = TEX_SIZE;

   for (i = 0; sz > 0; i++) {
      MakeImage(i, sz, sz, colors[i]);
      printf("Level %d size: %d x %d\n", i, sz, sz);
      sz /= 2;
   }
}
Exemplo n.º 11
0
void MainWindow::EnqueueImgModel(QModelIndex idx) {



    QString dir_path = current_dirpath_;
    QString file_name = idx.data().toString();
    QString ico_path = dir_path.append("\\").append(file_name);

    QImage* img_buffer = new QImage(ico_path);
    img_list_ << img_buffer;



    int xWidth=150, xHeight=100;

    double src_width = img_buffer->width();
    double src_height = img_buffer->height();

    xHeight = src_height / src_width * xWidth;

    qDebug() << xWidth << "*" << xHeight;


    QIcon icon = GetThumnail(img_buffer, xWidth, xHeight);

    QListWidgetItem* item = new QListWidgetItem(icon, file_name);
    ui->qImgListWidget->addItem(item);


    //이미지 붙이는 작업
    MakeImage();
}
Exemplo n.º 12
0
Image ToolButton::GetImage() const
{
	UPP::Image m = img;
	if(IsDarkColorFace() && !nodarkadjust)
		m = MakeImage(m, AdjustForDarkBk);
	m = CachedRescale(m, min(m.GetSize(), maxiconsize));
	return m;
}
Exemplo n.º 13
0
MenuItem& MenuItem::RightImage(const UPP::Image& img)
{
	ricon = img;
	if(IsDarkColorFace() && !nodarkadjust)
		ricon = MakeImage(ricon, AdjustForDarkBk);
	Refresh();
	return *this;
}
Exemplo n.º 14
0
Image GetUscImage(const String& id)
{
	Image m = GetImlImage(id);
	if(!IsNull(m))
		return AdjustColors(m);
	ImlImageMaker q;
	q.id = id;
	return MakeImage(q);
}
Exemplo n.º 15
0
Image CachedContrast(const Image& m, int d)
{
	if(d == 0)
		return m;
	sCachedContrast cr;
	cr.d = d;
	cr.img = m;
	return MakeImage(cr);
}
Exemplo n.º 16
0
			void KinotifyWidget::LoadTheme (const QString& themePath)
			{
				if (ThemeCache_.contains (themePath))
				{
					Theme_ = ThemeCache_ [themePath];
					return;
				}

				Theme_.clear ();

				QFile content (themePath + "/tmp.html");
				if (!content.open (QIODevice::ReadOnly))
				{
					qWarning () << Q_FUNC_INFO
							<< "could not open theme file at"
							<< content.fileName ()
							<< content.errorString ();
					return;
				}

				Theme_ = content.readAll ();

				const QPalette& palette = QApplication::palette ();

#define REPLACE1(a) { const QColor& c = palette.color (QPalette::a); \
					  Theme_.replace ("{Color"#a "}", QString ("%1, %2, %3").arg (c.red ()).arg (c.green ()).arg (c.blue ())); }
				REPLACE1 (Window);
				REPLACE1 (WindowText);
				REPLACE1 (Base);
				REPLACE1 (AlternateBase);
				REPLACE1 (ToolTipBase);
				REPLACE1 (ToolTipText);
				REPLACE1 (Text);
				REPLACE1 (Button);
				REPLACE1 (ButtonText);
				REPLACE1 (BrightText);
				REPLACE1 (Light);
				REPLACE1 (Midlight);
				REPLACE1 (Dark);
				REPLACE1 (Mid);
				REPLACE1 (Shadow);
				REPLACE1 (Link);
				REPLACE1 (LinkVisited);
				REPLACE1 (Highlight);
				REPLACE1 (HighlightedText);
#undef REPLACE1

				QDir imgDir (themePath + "/img");
				Q_FOREACH (QString elem, imgDir.entryList (QStringList ("*.png")))
					Theme_.replace (QString ("{%1}").arg (elem.left (elem.size () - 4)),
							MakeImage (themePath + "/img/" + elem));

				if (ThemeCache_.size () > 3)
					ThemeCache_.clear ();

				ThemeCache_ [themePath] = Theme_;
			}
Exemplo n.º 17
0
Image CachedRescale(const Image& m, Size sz, const Rect& src, int filter)
{
	if(m.GetSize() == sz)
		return m;
	sCachedRescale cr;
	cr.sz = sz;
	cr.src = src;
	cr.img = m;
	cr.filter = filter;
	return MakeImage(cr);
}
Exemplo n.º 18
0
			void KinotifyWidget::SetData ()
			{
				QString data = Theme_;
				data.replace ("{title}", Title_);
				data.replace ("{body}", Body_);
				if (OverridePixmap_.isNull ())
					data.replace ("{imagepath}", MakeImage (ImagePath_));
				else
					data.replace ("{imagepath}", MakeImage (OverridePixmap_));
				setHtml (data);

				if (!ActionsNames_.isEmpty ())
				{
					QWebElement button = page ()->mainFrame ()->documentElement ().findFirst ("form");
					if (!button.isNull ())
					{
						QStringList reversed = ActionsNames_;
						std::reverse (reversed.begin (), reversed.end ());
						Q_FOREACH (const QString& name, reversed)
							button.appendInside (QString ("<input type=\"button\" id=\"%1\" value=\"%2\""
									" onclick=\"Action.sendActionOnClick(id)\" />")
											.arg (ActionsNames_.indexOf (name))
											.arg (name));
					}
Exemplo n.º 19
0
void MainWindow::SelectedItemDelete() {
    QListWidgetItem* item = ui->qImgListWidget->currentItem();
    int index = ui->qImgListWidget->currentRow();

    if (item != NULL) {
        QImage* img = img_list_.at(index);
        img_list_.removeAt(index);
        delete img;
        delete item;
    }

    ui->qImgListWidget->clearSelection();

    //이미지를 다시 그린다.
    MakeImage();

}
Exemplo n.º 20
0
void KinotifyWidget::SetTheme (const QString& themePath)
{
    QFile content (themePath + "/tmp.html");
    QString output;

    if (content.open (QIODevice::ReadOnly))
    {
        output = content.readAll ();
        QStringList elements;
        elements << "back";
        Q_FOREACH (QString elem, elements)
        output.replace (QString ("{%1}").arg (elem),
        MakeImage (QString (themePath + "/img/%1.png").arg (elem)));
        content.close ();
        Theme_ = output;
    }
}
Exemplo n.º 21
0
static void Init(void)
{
   fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
   fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
   fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
   fflush(stderr);

   glClearColor(0.0, 0.0, 1.0, 0.0);

   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

   MakeImage();
   UpdateLine();
   line++;
}
Exemplo n.º 22
0
QSize KinotifyWidget::SetData ()
{
    QString data = Theme_;
    data.replace ("{title}", Title_);
    data.replace ("{body}", Body_);
    data.replace ("{imagepath}", MakeImage (ImagePath_));
    setHtml (data);

    int width = size ().width ();
    int height = size ().height ();

    QSize contents = page ()->mainFrame ()->contentsSize ();
    int cheight = contents.height ();

    if (cheight > height)
    height = cheight;

    return QSize (width, height);
}
Exemplo n.º 23
0
int CWndMapPartsGrp::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	SCROLLINFO stScrollInfo;

	if (CWnd::OnCreate(lpCreateStruct) == -1) {
		return -1;
	}

	GetScrollInfo (SB_HORZ, &stScrollInfo);
	stScrollInfo.nPage = 1;
	SetScrollInfo (SB_HORZ, &stScrollInfo);
	GetScrollInfo (SB_VERT, &stScrollInfo);
	stScrollInfo.nPage = 1;
	SetScrollInfo (SB_VERT, &stScrollInfo);

	MakeImage (m_nMode);

	return 0;
}
int CWndMapPartsAnimeList::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
//	SCROLLINFO stScrollInfo;
	CRect rc;

	if (CWnd::OnCreate(lpCreateStruct) == -1) {
		return -1;
	}
#if 0
	GetScrollInfo (SB_HORZ, &stScrollInfo);
	stScrollInfo.nPage = 1;
	SetScrollInfo (SB_HORZ, &stScrollInfo);
#endif

	GetWindowRect (rc);
	rc.bottom = rc.top + 15;
	SetWindowPos (NULL, 0, 0, rc.Width (), rc.Height (), SWP_NOZORDER | SWP_NOMOVE);

	MakeImage ();

	return 0;
}
Exemplo n.º 25
0
Image DisabledImage(const Image& img, bool dis)
{
	return dis ? MakeImage(img, GUI_GlobalStyle() == GUISTYLE_CLASSIC ? Etched : DisImage)
	           : img;
}
void CWndMapPartsAnimeList::Renew(void)
{
	MakeImage ();
	InvalidateRect (NULL);
}
Exemplo n.º 27
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    scene(new QGraphicsScene),
    dir_model_(new QFileSystemModel()),
    files_(new QFileSystemModel()),
    files_watcher_(new QFileSystemWatcher),
    file_model_(new QStandardItemModel()),
    img_queue_model_(new QStandardItemModel()),
    result(NULL),
    img_spacing_(0),
    img_margin_(0),
    status_text_("Select")
{
    ui->setupUi(this);
    statusBar()->addWidget(&status_text_);

    //QGraphicsView 관련변수 초기화
    //scene = new QGraphicsScene;
    ui->graphicsView->setScene(scene);



    //dir_model_ 초기화
    QString path = "./";
    //dir_model_ = new QFileSystemModel();
    dir_model_->setFilter(QDir::NoDotAndDotDot | QDir::Dirs);
    dir_model_->setRootPath(path);
    ui->treeView->setModel(dir_model_);
    ui->treeView->hideColumn(1);
    ui->treeView->hideColumn(2);
    ui->treeView->hideColumn(3);

    //
    //files_watcher_ = new QFileSystemWatcher;

    //file_model_ 초기화
    for(unsigned int i=0; i<kExtName::CNT; i++) {
        ext_lists_ << kExtName::STRING[i];
    }
    //files_ = new QFileSystemModel();
    //file_model_ = new QStandardItemModel();
    files_->setFilter(QDir::NoDotAndDotDot | QDir::Files);
    files_->setNameFilters(ext_lists_);
    files_->setNameFilterDisables(false);
    ui->fileView->setModel(file_model_);
    ui->fileView->setViewMode(QListView::IconMode);
    ui->fileView->setFlow(QListView::LeftToRight);
    ui->fileView->setGridSize(QSize(96,60));
    ui->fileView->setUniformItemSizes(true);
    ui->fileView->setEditTriggers(QAbstractItemView::NoEditTriggers);


    //qImageListWidget 초기화
    //img_queue_model_ = new QStandardItemModel();
    ui->qImgListWidget->setViewMode(QListView::IconMode);
    ui->qImgListWidget->setGridSize(QSize(170,115));
    ui->qImgListWidget->setFlow(QListView::LeftToRight);
    ui->qImgListWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
    ui->qImgListWidget->setWrapping(false);

    ui->qImgListWidget->setIconSize(QSize(161,100));
    ui->qImgListWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    ui->qImgListWidget->setResizeMode(QListView::Adjust);
    ui->splitter->setStretchFactor(1,2);


    //result = new QImage;

    QShortcut* shortcut = new QShortcut(QKeySequence(Qt::Key_Delete), ui->qImgListWidget);
    connect(shortcut, SIGNAL(activated()), this, SLOT(SelectedItemDelete()));    
    connect(files_, SIGNAL(directoryLoaded(QString)), this, SLOT(DirFilesFilter(QString)));
    connect(ui->fileView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(EnqueueImgModel(QModelIndex)));
    connect(file_model_, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(FileViewUpdate(QModelIndex)));
    connect(ui->qImgListWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(MakeImage()));
    connect(files_watcher_, SIGNAL(directoryChanged(QString)), this ,SLOT(chnageDir(QString)));
    ui->actionSave->setDisabled(true);


}
Exemplo n.º 28
0
Image ImageOverRed(const Image& m)
{
	return MakeImage(m, OverLtRed);
}
Exemplo n.º 29
0
static void
makeImages(int image)
{
#define WIDTH 512
#define HEIGHT 512
   if (glutExtensionSupported("GL_SGIS_generate_mipmap") && image) {
      /* test auto mipmap generation */
      GLint width, height, i;
      GLenum format;
      GLubyte *image = LoadRGBImage(TEXTURE_FILE, &width, &height, &format);
      if (!image) {
         printf("Error: could not load texture image %s\n", TEXTURE_FILE);
         exit(1);
      }
      /* resize */
      if (width != WIDTH || height != HEIGHT) {
         GLubyte *newImage = malloc(WIDTH * HEIGHT * 4);
         gluScaleImage(format, width, height, GL_UNSIGNED_BYTE, image,
                       WIDTH, HEIGHT, GL_UNSIGNED_BYTE, newImage);
         free(image);
         image = newImage;
      }
      printf("Using GL_SGIS_generate_mipmap\n");
      glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
      glTexImage2D(GL_TEXTURE_2D, 0, format, WIDTH, HEIGHT, 0,
                   format, GL_UNSIGNED_BYTE, image);
      glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_FALSE);
      free(image);

      /* make sure mipmap was really generated correctly */
      width = WIDTH;
      height = HEIGHT;
      for (i = 0; i < 10; i++) {
         GLint w, h;
         glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_WIDTH, &w);
         glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_HEIGHT, &h);
         printf("Level %d size: %d x %d\n", i, w, h);
         width /= 2;
         height /= 2;
      }
   }
   else {
      static const GLubyte colors[10][3] = {
         {128, 128, 128},
         {0, 255, 255},
         {255, 255, 0},
         {255, 0, 255},
         {255, 0, 0},
         {0, 255, 0},
         {0, 0, 255},
         {0, 255, 255},
         {255, 255, 0},
         {255, 255, 255}
      };
      int i, sz = 512;

      for (i = 0; i < 10; i++) {
         MakeImage(i, sz, sz, colors[i]);
         printf("Level %d size: %d x %d\n", i, sz, sz);
         sz /= 2;
      }
   }
}
Exemplo n.º 30
0
Image MakeImage(const Image& image, Image (*make)(const Image& image))
{
	return MakeImage(SimpleImageMaker(image, make));
}