本文整理汇总了C++中One::GetImage方法的典型用法代码示例。如果您正苦于以下问题:C++ One::GetImage方法的具体用法?C++ One::GetImage怎么用?C++ One::GetImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类One
的用法示例。
在下文中一共展示了One::GetImage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnLevelMapCalc
void MapEditor::OnLevelMapCalc(Level& level, int number)
{
if (level.GetMapBG().IsEmpty())
{
Exclamation(NFormat(t_("Please, select the image for level: %s"), level.GetName()));
return;
}
String fp = AppendFileName( AppendFileName( GetFileDirectory(GetExeFilePath()), "Maps"),
level.GetMapBG());
if (!FileExists(fp))
{
Exclamation(NFormat(t_("Image file not exist: %s"), fp));
return;
}
String name = level.GetName();
double zx = level.GetZoomDX();
Size pz = level.GetPageSize();
Size sz = level.GetCellSize();
FileIn in(fp);
One<StreamRaster> r = StreamRaster::OpenAny(in);
if (!r)
{
Exclamation(NFormat(t_("Error while loading image file: %s"), fp));
return;
}
Image img = r->GetImage();
Calculate(sz.cx, sz.cy, pz.cx, pz.cy, zx,
NFormat("%s-%d", _map.GetName(), number + 1), img);
}
示例2: LoadBuffer
bool RasterPlayer::LoadBuffer(const String &buffer) {
if (buffer.IsEmpty())
return false;
StringStream str(buffer);
One<StreamRaster> raster = StreamRaster::OpenAny(str);
if(!raster)
return false;
Stop();
images.Clear();
delays.Clear();
Size sz = raster->GetSize();
ImageDraw iw(sz);
Image previous;
Rect r;
for (int i = 0; i < raster->GetPageCount(); ++i) {
if (previous) {
iw.Alpha().DrawImage(r, previous, GrayColor(255));
iw.DrawImage(r, previous);
previous = Null;
}
raster->SeekPage(i);
r = raster->GetPageRect(i);
switch (raster->GetPageDisposal(i)) {
case 1:
case 2: iw.DrawRect(r, SColorFace());
break;
//case 2: iw.DrawRect(sz, White()); // It seems gif files do not comply with standard
// break;
case 4: if (i > 0)
previous = GetRect_(images[i-1], r);
iw.DrawRect(sz, SColorFace());
break;
}
iw.Alpha().DrawImage(r.left, r.top, raster->GetImage(0, 0, r.right-r.left, r.bottom-r.top), GrayColor(255));
iw.DrawImage(r.left, r.top, raster->GetImage(0, 0, r.right-r.left, r.bottom-r.top));
images.Add(iw);
delays.Add(max(50, 10*raster->GetPageDelay(i)));
}
ind = 0;
return true;
}
示例3: ToImage
Image RichRawImage::ToImage(const Value& data, Size sz, void *) const
{
String s = data;
StringStream ss(s);
One<StreamRaster> r = StreamRaster::OpenAny(ss);
if(r) {
Image x = r->GetImage();
return Rescale(x, sz);
}
return Null;
}
示例4: Paint
void RichRawImage::Paint(const Value& data, Draw& w, Size sz, void *) const
{
String s = data;
StringStream ss(s);
One<StreamRaster> r = StreamRaster::OpenAny(ss);
if(r) {
Size isz = r->GetSize();
if(isz.cx * isz.cy > sz.cx * sz.cy) { // conserve memory by scaling down from source
ImageEncoder m;
Rescale(m, sz, *r, r->GetSize());
w.DrawImage(0, 0, sz.cx, sz.cy, m);
}
else
w.DrawImage(0, 0, sz.cx, sz.cy, r->GetImage()); // scale up by Draw to give e.g. PDF chance to store unscaled
}
}
示例5: LoadImage
void ImageMT::LoadImage()
{
FileSel dlg;
dlg.Type("Image files","*.bmp *.png *.tif *.jpg");
dlg.Type("Image: JPEG","*.jpg");
dlg.Type("Image: Portable Nework Graphics","*.png");
dlg.Type("Image: Tagged Image Format","*.tif");
dlg.Type("Image: Windows Bitmap (24bit)","*.bmp");
dlg.ActiveDir(GetCurrentDirectory());
if(!dlg.ExecuteOpen("Open Image"))return;
SetCurrentDirectory(dlg.GetActiveDir());
String path = ~dlg;
FileIn in(path);
if(in.IsError())
{
String s = Format("Error opening image file %s",path);
PromptOK(s);
return;
}
One<StreamRaster> r = StreamRaster::OpenAny(in);
if(!r)
{
String s = Format("Error opening streamraster file %s",path);
PromptOK(s);
return;
}
Layer* pLayer = new Layer;
Size sz = GetSize();
pLayer->m_img = r->GetImage();
pLayer->m_rc.left = 0;
pLayer->m_rc.right = 1;
pLayer->m_rc.top = 0;
pLayer->m_rc.bottom = 1;
m_pLayers.Add(pLayer);
}
示例6: in
virtual IdeDesigner *CreateDesigner(const char *path, byte) {
if(IsImgFile(path)) {
FileIn in(path);
One<StreamRaster> o = StreamRaster::OpenAny(in);
if(o) {
Size sz = o->GetSize();
if(ToLower(GetFileExt(path)) == ".png" && sz.cx <= 768 && sz.cy <= 512) {
IdePngDes *d = new IdePngDes;
d->Load(path);
d->RestoreEditPos();
return d;
}
else {
IdeImgView *d = new IdeImgView;
d->img_sz = sz;
d->filename = path;
if(sz.cx <= 1024 && sz.cy <= 768)
d->img = o->GetImage();
else {
ImageEncoder m;
Rescale(m, GetFitSize(sz, Size(1024, 768)), *o, sz);
d->img = m;
}
return d;
}
}
else
if(ToLower(GetFileExt(path)) == ".png" && GetFileLength(path) <= 0) {
IdePngDes *d = new IdePngDes;
d->Create(path);
d->RestoreEditPos();
return d;
}
}
return NULL;
}