MCPcopy Create free account
hub / github.com/cinder/Cinder / drawGui

Method drawGui

samples/ImageFileBasic/src/ImageFileBasicApp.cpp:98–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98void ImageFileBasicApp::drawGui()
99{
100 ImGui::Begin( "Image Info" );
101
102 if( ImGui::Button( "Open Image" ) )
103 openImageDialog();
104
105 ImGui::SameLine();
106
107 ImGui::BeginDisabled( ! mTexture );
108 if( ImGui::Button( "Save Image" ) )
109 saveImageDialog();
110 ImGui::EndDisabled();
111
112 ImGui::SameLine();
113
114 ImGui::BeginDisabled( ! mTexture );
115 if( ImGui::Button( "Fit to Window" ) ) {
116 mCanvas.setContentBounds( Rectf( mTexture->getBounds() ) );
117 mCanvas.fitAll();
118 }
119 ImGui::EndDisabled();
120
121 ImGui::Separator();
122
123 if( mTexture && mImageSource ) {
124 ImGui::Text( "File: %s", mImagePath.filename().string().c_str() );
125 ImGui::Separator();
126 ImGui::Text( "Dimensions: %d x %d", mTexture->getWidth(), mTexture->getHeight() );
127 ImGui::Text( "Texture Format: %s", gl::constantToString( mTexture->getInternalFormat() ).c_str() );
128 ImGui::Separator();
129
130 // Image source information
131 const char* colorModelStr = "Unknown";
132 switch( mImageSource->getColorModel() ) {
133 case ImageIo::CM_RGB: colorModelStr = "RGB"; break;
134 case ImageIo::CM_GRAY: colorModelStr = "Grayscale"; break;
135 default: break;
136 }
137 ImGui::Text( "Color Model: %s", colorModelStr );
138
139 const char* dataTypeStr = "Unknown";
140 switch( mImageSource->getDataType() ) {
141 case ImageIo::UINT8: dataTypeStr = "UINT8"; break;
142 case ImageIo::UINT16: dataTypeStr = "UINT16"; break;
143 case ImageIo::FLOAT16: dataTypeStr = "FLOAT16"; break;
144 case ImageIo::FLOAT32: dataTypeStr = "FLOAT32"; break;
145 default: break;
146 }
147 ImGui::Text( "Data Type: %s", dataTypeStr );
148
149 const char* channelOrderStr = "Unknown";
150 switch( mImageSource->getChannelOrder() ) {
151 case ImageIo::Y: channelOrderStr = "Y (Grayscale)"; break;
152 case ImageIo::YA: channelOrderStr = "YA (Grayscale + Alpha)"; break;
153 case ImageIo::RGB: channelOrderStr = "RGB"; break;
154 case ImageIo::RGBA: channelOrderStr = "RGBA"; break;
155 case ImageIo::RGBX: channelOrderStr = "RGBX"; break;

Callers

nothing calls this directly

Calls 15

constantToStringFunction · 0.85
ImVec4Class · 0.85
setContentBoundsMethod · 0.80
fitAllMethod · 0.80
filenameMethod · 0.80
getInternalFormatMethod · 0.80
getColorModelMethod · 0.80
isPremultipliedMethod · 0.80
getBoundsMethod · 0.45
c_strMethod · 0.45
stringMethod · 0.45
getWidthMethod · 0.45

Tested by

no test coverage detected