C# :: Save Image In Layers And Then Load Layers Separately
Oct 4, 2013
I am programming an application in c# that allows the user to edit images. The user can use a Pen to write on the image, and the user can also use a highlighter (a big semi-transparent Pen) to highlight what they've written. I need the user to be able to erase only the highlighting without erasing the pen drawings.
My solution was to have the user draw on one graphics window when the pen is selected and draw on the other graphics window when the highlighter is selected. I will then enable the eraser on either graphics window depending on what the user wants to erase.
My program will let the user save the image and then load it into the program again for later editing. When I save the image, I have to compress the layers (different graphics windows) into one bitmap. When I load the bitmap back into my application, I lose my layers and cannot erase just the highlighting without also erasing the pen as well.
How can I save an image file with layers, and then recover the layers when my program starts up again?
I am not opposed to saving two images - one with the pen graphics window and the other with the highlighting. If I do that, how can I merge the two images into one layer when I load the images back into my program?
View 2 Replies
ADVERTISEMENT
Nov 26, 2013
I am trying to put my Save and Load function in my game, this is what i have:
Code:
/* Save game */
void GuardarJuego() {
FILE *fsave;
char turno;
fsave=fopen("SAVE.txt", "w");
fputs(*****, fsave);
[Code] .....
My game code is this: [C] GameCode - Pastebin.com
View 8 Replies
View Related
Jun 5, 2014
I have been trying to figure this out for a text based game. Lets say your money is 500. Then you save your game, but when you start the game the starting is 50, so when you load it, you still have 500 money, I tried lots of test, and im having trouble?
View 10 Replies
View Related
Oct 16, 2013
I've been working on a battle simulator, and using it as a learning experience. So far, I've been able to debug the program, and learn some stuff, and it's been running smoothly. It's still runnable, but I've been trying to make it so the player can save his character, and continue the game later. However, I'm not sure whether it's the save or load function that's not working, because even if i save to a txt file, it's just a bunch of random characters. I don't know if that means it's not saving correctly, or if it's just supposed to be like that. Anyway, here are the two functions I'm speaking of:
Code:
void Game::saveGame(Character &player) {
std::ofstream saveFile("save.bin", ios::binary);
saveFile.write((char *)&player, sizeof(player));
saveFile.close();
[Code] .....
My program is in multiple files, so I can't really post the whole code easily, but I can upload or something if I really need to.
View 14 Replies
View Related
May 24, 2014
I'm trying to load a PNG image to use as texture, but when I compile the sdl window closes. I'm sure the error is in the function of generating the png texture, because when i donĀ“t use this function, the sdl window does not close. So debugging using cout i found that the cout above glTexImage2D function, shows in console, but the cout in below of glTexImage2D does not work. Does not reading this image?
hear is the function
#include "Texture.h"
#include <iostream>
Texture::Texture() {}
[Code].....
View 9 Replies
View Related
Dec 12, 2014
I have:
An Access database in which the picture right now is saved by its directory, together with other field like title, publisher, developer,..
Visual Studio form in which a load button gets that directory as text
Details button that reads the ID of a selected item (I have a list of games) and displays the corresponding picture by reading the directory
The problem right now is that once someone else opens the program on his/her computer, the directory changes, making the whole thing useless.
Is there a way to get around this problem? The books I've been reading don't really adress this.
Directory is a string in class 'Game'; it's short text in the database
private void buttonFoto_Click(object sender, EventArgs e) {
LoadNewFile();
}
private void LoadNewFile() {
OpenFileDialog ofd = new OpenFileDialog();
[code].....
View 9 Replies
View Related
Sep 10, 2013
I am trying to retrieve an image from its URL as an array where each box represents the pixel value of the image.
View 3 Replies
View Related
Jul 31, 2014
I want to take screen shot and save it in any image format like jpg, bmp, ppm or any other .
View 3 Replies
View Related
Jun 7, 2014
i need to capture the console screen and save to a image:)
View 3 Replies
View Related
Jun 25, 2012
Is it possible to save web page as image with web application? if yes then how?.I searched and searched and searched but all examples i found were for windows application and i'm facing lot of trouble while converting it for web application.
View 1 Replies
View Related
Jun 11, 2013
I'm trying to read from a header file to take the image dimensions and other variables but I don't understand how to iterate through the "key" so it saves each line.
This is what the header file will always look like:
!INTERFILE :=
!imaging modality := nucmed
!version of keys := 3.3
;
!GENERAL DATA :=
[Code].....
Ideally it would just skip the keys that aren't wanted and keep moving through the lines. Should there be a for loop for the key (and if so, how does that work with pointers?) or should this method just be scratched...
View 6 Replies
View Related
Apr 17, 2014
I was trying to capture entire web screen and save as .jpeg format.
So far I have done this using C# Windows Application.
Same thing I am willing to do in 'VC++ 2010 Win32. In my C++ project I have created a Toolbar with a button on IE 9 browser. And on Toolbar button click I can print current window.
But I don't know how to take a snapshot and save to specified directory in .jpeg format using VC++ 2010. I have Windows 7.
View 4 Replies
View Related
Sep 9, 2014
I am trying to automatically(periodically) print screen a custom area of the screen, save it as an image file (the image will have the same format always), and then use OCR to get the text in the image as usable string variables. Is this doable? I was looking into tesseract OCR but I find it a bit unclear.
View 10 Replies
View Related
Nov 1, 2013
I am trying to write a program that prints a 2d array to the screen and then compares each row and column to see if there is any pairs of letters. basically something that looks like this:
---------------------------
V T A Y U C B
D F W Q Q C R
D A L Y M F G
O A S S D T I
Number of horizontal pairs: 2
Number of vertical pairs: 3
---------------------------
so far this is my code below, but i dont know how to approach the comparisons
Code:
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main( void )
[code]....
View 9 Replies
View Related
Mar 4, 2014
How do I enter the equation all at once instead of prompting for each piece separately?
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
[Code].....
View 4 Replies
View Related
Apr 11, 2014
There is any method to compile a method of a class separately from the other methods and the main.
View 1 Replies
View Related
Feb 25, 2015
How can i count total number of each topic separately? For example total number of topic 1 between all nodes. To begin enter 10 and 7 to initial node number and number of topic.
#include <iostream>
#include <vector>
#include <list>
#include <stdlib.h>
#include<time.h>
#include<iomanip>
#include <iostream>
#include <string>
[Code] ....
View 1 Replies
View Related
Apr 1, 2014
I having trouble with the rational class
here is my assignment:
Add a square root function to the rational class. Have your program print the square root of any rational number. I want to find the square root for numerator and denominator separatetly. divide the answer to get decimals and convert the decimal to fractions. i got till geting the decimal but i want to convert it back to a simplified fraction
// finding greatest common factor
int gcd(int a, int b)
{
if (b == 0)
return a;
else
return gcd(b, a % b);
}
[Code]...
View 2 Replies
View Related
Jan 28, 2015
1st when i fill the things on form then saved in database after saving record when i want add another record it shows an error. after saving it saves new record refresh doesn't work
View 1 Replies
View Related
Nov 5, 2013
I am trying to develop a GUI using MFC, but I am having trouble using CFiledialog to save a file. The problem is, the file is not getting saved to the folder when I use the CFiledialog. Below is the code I am using.
Code:
CString szFilter = "XNRep Files (*.xnrep)|*.xnrep||";
CString s = "xnrep";
CString t = "";
CFileDialog fileDlg(FALSE, s, t, NULL, szFilter);
if(fileDlg.DoModal() == IDOK)
{
std::ofstream file;
[Code]....
After the file dialog opens up, I enter the name of the file and select OK button. But the file does not show up in the directory I am saving to.
View 4 Replies
View Related
Jul 3, 2014
Im trying to compare the image of a button to another image in Visual Studio like so...
//variables
Image active = Image.FromFile("C:\Users\Ethan\Desktop\StarWars Status\active.png");
Image stunned = Image.FromFile("C:\Users\Ethan\Desktop\StarWars Status\stunned.png");
[Code]...
btnStatusPlr1.Image SHOULD come back as True.Then I realized it might not be the same as setting the buttons image in the properties (Which is what i did to get the original image (the one being compared to))
I do have a feeling ive done something wrong here (Yes im a noob /> )
Variable active, is the same image as the buttons default (Well should be)
View 1 Replies
View Related
Sep 26, 2013
Let's say I create a small program or just want to open any kind of file on my computer, but I want to run a program that forces the user to enter a password or something (I already know this part). How does one create the code that would open the file?
View 5 Replies
View Related
Apr 8, 2013
I don't mean how do I load a bmp, I mean how does SDL manage to do this?
View 2 Replies
View Related
Dec 29, 2014
i have made this first level in this ascii game, and i realized that if i want to continue, i must rewrite the switch statement and write thousands of lines of code. how can i load a map from a txt file?
#include <iostream>
#include <windows.h>
using namespace std;
[Code].....
View 3 Replies
View Related
Mar 22, 2014
I am trying to run a console program but for any reason it displays an error on the cv.h line.
View 5 Replies
View Related
Jan 18, 2013
I have a Visual C++ workspace that has 2 projects (1 exe & 1 DLL). I used Serge Wautier's tutorial [URL] .... to create (multi-language) resource DLLs (satellite DLLs) branching off the exe.
Now I have a collection of strings in the DLL that are shared in other projects. I created a satellite DLL for that DLL but can't figure out how to load it on-demand just like the exe's satellite DLL.
He used:
HINSTANCE hDll = LoadLibrary(szFilename);
AfxSetResourceHandle(hDll);
void CLanguageSupport::UnloadResourceDll() {
if (m_hDll!=NULL) {
SetResourceHandle(AfxGetApp()->m_hInstance); // Restores the EXE as the resource container.
FreeLibrary(m_hDll);
m_hDll= NULL;
}
}
etc etc ... for the unloading/loading satellite DLLs for the exe. But how to do the same for the DLL?
View 5 Replies
View Related