: m_GuidesEnabled(
false)
71, m_TileAspectRatio(-1.0f)
72, m_ImageAspectRatio(-1.0f)
73, m_DisableGouraudShaded(
false)
96 if(progress !=
NULL)
99 if(!glewIsSupported(
"GL_EXT_framebuffer_object")) {
100 _TRACE(
"Opengl: Feature not available");
104glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
111 CImageimg(tex_size, tex_size, 4);
123glGetIntegerv(GL_PACK_ALIGNMENT, &alignment);
124glPixelStorei(GL_PACK_ALIGNMENT, 1);
130glDisable(GL_TEXTURE_2D);
153 if(img.
GetWidth() != capture_size.
X() ||
155img.
Init(capture_size.
X(), capture_size.
Y(), 4);
158glReadPixels(0, 0, (GLsizei)capture_size.
X(), (GLsizei)capture_size.
Y(),
159GL_RGBA, GL_UNSIGNED_BYTE, img.
SetData());
171 else if(progress !=
NULL) {
185glPixelStorei(GL_PACK_ALIGNMENT, alignment);
202 if(!glewIsSupported(
"GL_EXT_framebuffer_object")) {
203 _TRACE(
"Opengl: Feature not available");
207glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
219glGetIntegerv(GL_PACK_ALIGNMENT, &alignment);
220glPixelStorei(GL_PACK_ALIGNMENT, 1);
224glDisable(GL_TEXTURE_2D);
243 if(img->
GetWidth() != capture_size.
X() ||
245img->
Init(capture_size.
X(), capture_size.
Y(), 3);
248glReadPixels(0, 0, (GLsizei)capture_size.
X(), (GLsizei)capture_size.
Y(),
249GL_RGB, GL_UNSIGNED_BYTE, img->
SetData());
255glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
256glDrawBuffer(GL_BACK);
257glReadBuffer(GL_BACK);
264glPixelStorei(GL_PACK_ALIGNMENT, alignment);
274 intref_img_width,
intref_img_height,
282 if(!glewIsSupported(
"GL_EXT_framebuffer_object")) {
283 _TRACE(
"Opengl: Feature not available");
292 intref_image_size = 64;
293 while(ref_image_size <
size)
303glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
305 inttarget_tile_width, target_tile_height;
306vector<IImageGrabberProgress::CTileOrigin> tile_positions;
307tile_positions = p->
GetTileLocations(target_tile_width, target_tile_height);
314 floattile_scale_x = ((float)ref_image_size)/(float)tiled_width;
315 floattile_scale_y = ((float)ref_image_size)/(float)tiled_height;
335glDisable(GL_TEXTURE_2D);
364 intoriginx = tile_pos.
m_TileIndex.
X()*target_tile_width*tile_scale_x;
366target_tile_height*tile_scale_y;
372glViewport(originx, originy,
373(
int)((
float)target_tile_width)*tile_scale_x + 1,
374(
int)((
float)target_tile_height)*tile_scale_y + 1);
375glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
377glMatrixMode(GL_MODELVIEW);
381glMatrixMode(GL_PROJECTION);
384gluOrtho2D(0.0, 1.0, 0.0, 1.0);
386glEnable(GL_TEXTURE_2D);
387glBindTexture(GL_TEXTURE_2D, tile_buffer.
GetTexture());
389 floatcapture_ratiox = ((float)capture_size.
X())/(
float)tex_size;
390 floatcapture_ratioy = ((float)capture_size.
Y())/(
float)tex_size;
393glTexCoord2f(0.0f, 0.0f);
394glVertex3f(0.0f, 0.0f, 0.0f);
396glTexCoord2f(capture_ratiox, 0.0f);
397glVertex3f(1.0f, 0.0f, 0.0f);
399glTexCoord2f(capture_ratiox, capture_ratioy);
400glVertex3f(1.0f, 1.0f, 0.0f);
402glTexCoord2f(0.0f, capture_ratioy);
403glVertex3f(0.0f, 1.0f, 0.0f);
409glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
410glDrawBuffer(GL_BACK);
411glReadBuffer(GL_BACK);
416glMatrixMode(GL_PROJECTION);
423glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
424glDrawBuffer(GL_BACK);
425glReadBuffer(GL_BACK);
475glViewport(0, 0, (GLsizei)capture_size.
X(), (GLsizei)capture_size.
Y());
476glMatrixMode(GL_PROJECTION);
479glOrtho(0.0, (
double)capture_size.
X(),
4800.0, (
double)capture_size.
Y(),
483glMatrixMode(GL_MODELVIEW);
487glColor3f(0.7f, 0.7f, 0.7f);
489glEnable(GL_LINE_STIPPLE);
490glLineStipple(8, (
short)0x0307);
495glBegin(GL_LINE_LOOP);
506glDisable(GL_LINE_STIPPLE);
518font_height =
std::max(font_height, (
unsigned int)8);
521glColor3f(1.0f, 0.0f, 0.0f);
525 if(image_name !=
"") {
526 inttext_width = (
int)img_name_font.
TextWidth(image_name.c_str());
528((
int)capture_size.
Y()) - (font_height+2),
532glColor3f(0.25f, 0.25f, 0.25f);
536 if(image_bottom !=
"") {
538 inttext_width = (
int)img_name_font.
TextWidth(image_bottom.c_str());
539img_name_font.
WriteText(((
int)capture_size.
X())/2-text_width/2,
541image_bottom.c_str());
544 if(image_top !=
"") {
546 inttext_width = (
int)img_name_font.
TextWidth(image_top.c_str());
547img_name_font.
WriteText(((
int)capture_size.
X())/2-text_width/2,
548((
int)capture_size.
Y())-(font_height+2),
552 if(image_right !=
"") {
554 inttext_width = (
int)img_name_font.
TextWidth(image_right.c_str());
555img_name_font.
WriteText(((
int)capture_size.
X()) - 4,
556((
int)capture_size.
Y())/2-text_width/2,
557image_right.c_str(), 90.0f);
560 if(image_left !=
"") {
562 inttext_width = (
int)img_name_font.
TextWidth(image_left.c_str());
563img_name_font.
WriteText(font_height + 2,
564((
int)capture_size.
Y())/2-text_width/2,
565image_left.c_str(), 90.0f);
569glMatrixMode(GL_MODELVIEW);
572glMatrixMode(GL_PROJECTION);
virtual void ReleaseTexture()
Releases ownership of texture so it isn't deleted with framebuffer.
void SetTextureWrap(GLint wraps, GLint wrapt)
Set texture paramters, if needed. Call before calling CreateFrameBuffer.
void MakeCurrent(bool b)
Makes this framebuffer the current rendering target if b==true, and if b==false, makes the rendering ...
virtual void GenerateMipMaps()
Generates mipmaps for the texture rendering target.
static bool CheckFBOError()
Returns true and writes error message if framebuffer is invalid.
virtual void SetTextureFiltering(GLint min_filter, GLint mag_filter)
Set texture filtering parameters (default: GL_LINEAR)
virtual bool IsValid()
Returns true if framebuffer was created successfully.
virtual void CreateFrameBuffer()
Create, set and validate framebuffer.
static IImageGrabber * CreateImageGrabber(EOutputFormat format, IVectorGraphicsRenderer &pane)
static bool WriteImage(const CImage &image, CNcbiOstream &ostr, EType type, ECompress compress=eCompress_Default)
static EType GetTypeFromFileName(const string &file)
size_t GetWidth(void) const
void Init(size_t width, size_t height, size_t depth)
size_t GetHeight(void) const
unsigned char * SetData(void)
virtual void ImageSaved(int, int)
virtual void SetGLContext()
virtual void SetPreviewSubImage(CRef< CImage >)
Set an image to be displayed in the center of the widget.
virtual void SetReferenceImage(CGlTexture *refimg)
Return texture so that the preview image can be updated.
virtual vector< CTileOrigin > GetTileLocations(int &w, int &h)
Get locations (origin and size) of individual image tiles.
std::string m_BaseImageName
Image name without its appended number (e.g. img for img1, img2...)
std::string x_GetImageName(int x, int y)
Return image filename for a tile index based on the numbering scheme.
eCaptureResult PreviewImages(int tex_size, int ref_img_width, int ref_img_height, IImageGrabberProgress *p=NULL)
Grab images to update the on-screen image to approximate final output.
virtual eCaptureResult GrabImages(int tex_size, IImageGrabberProgress *p=NULL)
Grab the requested images.
std::string m_Directory
Target directory for saved images.
std::string m_ImageFormat
Image output format (e.g. jpeg, png...)
void x_RenderGuides(CVect2< size_t > capture_size, const std::string &image_name, std::string image_bottom, std::string image_right, std::string image_top, std::string image_left)
Render guides around image edge (cut marks + adjacent image names)
eImageNumberingFormat m_NumberingFormat
Numbering format, such as sequential or tiled (x and y)
virtual void x_EndCaptures()
Called after last image captured.
bool m_GuidesEnabled
If true, printing guides (like where to cut paper) will be added to image edges.
int m_GuideWidthX
If we are making space for printing guides (margins) on the sides, those margins may have different s...
virtual void x_BeginCaptures(int)
Called before first image captured.
virtual eCaptureResult x_CaptureImage(CVect2< int > partitions, CVect2< int > index, CVect2< size_t > &capture_size)
Must be subclassed to capture an individual image.
CVect2< int > m_ImagePartitions
Number of partitions (tilings) in x and 1.
CIRef< IRender > m_SavedRender
eCaptureResult GrabImage(int tex_size, CVect2< int > img_idx, IImageGrabberProgress *p=NULL)
Grab a single image for preview purposes.
void SetOutputInfo(const std::string &dir, const std::string &base_name, const std::string &img_format)
Set file output information.
Interface class for the pdf renderer.
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
static string ConcatPath(const string &first, const string &second)
Concatenate two parts of the path for the current OS.
static CGlResMgr & Instance()
CIRef< IRender > GetCurrentRenderer()
Returns current renderer, or NULL.
void WriteText(TModelUnit x, TModelUnit y, const char *text, TModelUnit rotate_degrees=0.0) const
Write text at specified model coords.
void SetFontFace(EFontFace face, bool use_bitmap_overrides=true)
void BeginText() const
WriteText interface The WriteText functions produce the same results as TextOut but they are more eff...
static bool CheckGlError()
Check if there are any OpenGL errors.
void SetCurrentRenderer(CIRef< IRender > rm)
Set current renderer (rm must already be in m_Renderers)
void EndText() const
Pops matrices and attributes after writing text.
virtual TModelUnit TextWidth(const char *text) const
Compute and return font metrics.
void SetFontSize(unsigned int size)
Set/get font size in points.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
unsigned int
A callback function used to compare two keys in a database.
The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
CVect2< int > m_TileIndex
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4