You just have to memorize in variable the x, y and size coordinates of each image. It is quite simple to implement because there is no need to list all the files each time to find the one to extract. If you don't want it to be visible easily, you can encrypt the files, but it will take longer at startup. However the images will be visible if the user has the idea to use an image viewer that reads the header and does not just follow the extension. It avoids a considerable loss of real disk space and entry in the allocation table. It is also a system used when you have a lot of small files (icons for example) with a smaller size than the clusters on the hard disk. (That's how I do it for my little Launcher (add/del ico)) You can give your file(s) any extension, since it is a data file, it does not need to be associated (ex. Then use GrabImage() to extract the images. Assemble all your images into one (side by side or on a page)Ģ. So I'm going back to the idea I had submitted at the beginning (and deleted)ġ. The program has to decompress twice (once the zip file and once the image with the image lib (if the images are in jpg or png)) Especially since PNG and JPG files are already compressed. If extension=".gif" Or extension=".jpe" Or extension=".jpg" Or extension=".bmp"įile = OpenFileRequester("Open image file","","Windows BMP Image (*.bmp)|*.bmp|GIF Image (*.gif)|*.gif|Jpeg Image (*.jpg)|*.jpe *.jpg", 0)įile = SaveFileRequester("Save image file","","Windows BMP Image (*.bmp)|*.The compressed file solution will not necessarily be more optimal. ResizeWindow(ImgWidth*2, (ImgHeight*2)+MenuHeight) ResizeWindow(ImgWidth/2, (ImgHeight/2)+MenuHeight) SetWindowText_(ParentHandle, "Picture View - "+File+" 100%") ImageGadget = ImageGadget(0, 0, MenuHeight, WindowWidth(), WindowHeight()+MenuHeight, UseImage(0))ĪddKeyboardShortcut(0, #PB_Shortcut_O|#PB_Shortcut_Control, #Open)ĪddKeyboardShortcut(0, #PB_Shortcut_S|#PB_Shortcut_Control, #Save)ĪddKeyboardShortcut(0, #PB_Shortcut_Q|#PB_Shortcut_Control, #Quit)ĪddKeyboardShortcut(0, #PB_Shortcut_Pad0|#PB_Shortcut_Alt|#PB_Shortcut_Control, #Actual)ĪddKeyboardShortcut(0, #PB_Shortcut_Add, #Zoom_In)ĪddKeyboardShortcut(0, #PB_Shortcut_Subtract, #Zoom_Out)ĪddKeyboardShortcut(0, #PB_Shortcut_C|#PB_Shortcut_Control, #Copy)ĪddKeyboardShortcut(0, #PB_Shortcut_V|#PB_Shortcut_Control, #Paste)ĭragQueryFile_(hDrop, 0, MemoryID(), 256) SetClassLong_(ParentHandle, #GCL_HBRBACKGROUND, CreateBrushIndirect_(Brush))ĬreateImage(0, WindowWidth(), WindowHeight()) MenuHeight = GetSystemMetrics_(#SM_CYCAPTION)+GetSystemMetrics_(#SM_CYMENU)+8 If OpenWindow(0, 100, 100, 480, 320, #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget, "Little Image Tool") SetWindowText_(ParentHandle, "Picture View - "+File+" "+StrF(((ImgWidth/IData\width)*100), 2)+"%") If WindowWidth=ptMinTrackSizex And ImgWidth> 16 Global nwidth, nheight, hmheight, hmwidth, rc.RECT Global IData.ImageData, BmpSize, BmpImage, FileSize, loaded.b, WindowWidth, WindowHeight, ImgWidth, ImgHeight, MenuHeight, xImg, yImg, ParentHandle, ptMinTrackSizex, aspect.f, hDC Thanks: Rings for helping me to deal with bitmaps in memory The PureBASIC Archives repo was created by Tristano Ajmone ( tajmone) as a centralized place for gathering and sharing PureBASIC-related resources: code examples and snippets, libraries, tutorials, books, and links anything that can simplify a programmer’s life by either being herein archived or linked/reviewed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |