From e2788e483e1b13ce215141fb3d915ec532c75eb3 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 21 Jun 2017 00:37:33 +0200 Subject: [PATCH] Scale imported raw data --- examples/raw_importer/raw_importer.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/examples/raw_importer/raw_importer.c b/examples/raw_importer/raw_importer.c index 8e6ea10..f24d6e0 100644 --- a/examples/raw_importer/raw_importer.c +++ b/examples/raw_importer/raw_importer.c @@ -116,13 +116,18 @@ int main(int argc, char *argv[0]) showImportPanel = false; btnLoadPressed = false; - imageLoaded = true; + + if (texture.id > 0) + { + imageLoaded = true; + imageScale = 400.0f/texture.height; + } } } if (imageLoaded) { - // Image zoom control + // Image scale control imageScale += (float)GetMouseWheelMove(); } //---------------------------------------------------------------------------------- @@ -135,7 +140,12 @@ int main(int argc, char *argv[0]) DrawRectangleLines(10, 10, SCREEN_WIDTH - 20, SCREEN_HEIGHT - 20, GuiLinesColor()); - if (texture.id != 0) DrawTextureEx(texture, (Vector2){ SCREEN_WIDTH/2 - texture.width*imageScale/2, SCREEN_HEIGHT/2 - texture.height*imageScale/2 }, 0, imageScale, WHITE); + if (texture.id != 0) + { + DrawTextureEx(texture, (Vector2){ SCREEN_WIDTH/2 - texture.width*imageScale/2, SCREEN_HEIGHT/2 - texture.height*imageScale/2 }, 0, imageScale, WHITE); + DrawText(FormatText("SCALE x%.0f", imageScale), 20, SCREEN_HEIGHT - 40, 20, LIGHTGRAY); + + } else DrawText("drag & drop RAW image file", 320, 180, 10, GRAY); if (showImportPanel)