C# :: Manipulating Images Colors With ColorMatrix?
Feb 6, 2015
I found this elegant looking code on the net that claims to be able to manipulate an images colors using ColorMatrix.
When I run it, it does nothing! I used the code exactly as is with no editing, except to feed it my own image to do its work.
private void ApplySaturation(float saturation) {
float rWeight = 0.3086f;
float gWeight = 0.6094f;
float bWeight = 0.0820f;
float a = (1.0f - saturation) * rWeight + saturation;
[code].....
View 8 Replies
ADVERTISEMENT
Jan 31, 2015
So, it seems I have a bug in my code:
Code:
char *mem = malloc(9), *bottom = malloc(3), *in = "abc";
int position = 2, i;
mem = "onetwo";
printf("OLD mem = %s
", mem);
[Code]....
What I'm trying to do is insert "abc" in the 3rd position of "onetwo". Results would be "oneabctwo", but all I get is crashing.
View 9 Replies
View Related
Sep 28, 2014
How can I manipulate a data in a file for example the saved file is like this:
code name Price Quantity
001 hammer 100 4
002 screwdriver 100 4
what i like to do is:
1. the user will be ask to enter its code
2. will output the searched code and then
3. the user will be ask to enter how many pcs he/she will buy.the formula should be
pcs=pcs-users_input if the user selected the code 001 and enters only 1pc it should be updated to only 3 pcs left in the file.
View 5 Replies
View Related
Apr 10, 2014
We were given a task to use lists and iterators. We were supposed to make them from scratch. I'm done with that. The problems that I'm having are as following:
1. I'm not able to access the list made of Course datatype which is present in each Student instance. Does this mean I need to make an iterator for that course list inside the student class?
2. Similarly since I don't have direct access to The course list so I added the course into the Student list through the student objects not through the iterator. How can I do it through the iterator?
3. Printing of a particular student and his courses is not happening as my iterator made for student only prints out the students, not the courses present in their courselist. How to do that?
Here's the code
#include <iostream>
#include <string>
using namespace std;
const int ILLEGAL_SIZE = 1;
const int OUT_OF_MEMORY = 2;
const int NO_SPACE = 3;
const int ILLEGAL_INDEX = 4;
[Code] .....
View 1 Replies
View Related
Jul 7, 2012
File Data format
A,A
A,B
C,E
C,F
And so on ... it could be up to any alphabet. The number of As and Bs and Cs and Ds in first column depends on the number of unique alphabets used in the first column. For example the unique alphabets used in this case are 2 (A,C) hence each alphabet appears in the first column of consecutive 2 rows.
Which means
Code:
A:A,B,C,D
B:B,C,D,E
C:C,D,E,F
D:D, ,F,G (E is missing)
Actual Data
A,1
A,2
A,3
A,4
C,18
C,33
Final Solution: Add each integer value to its previous value and store the resulting value.
View 8 Replies
View Related
Jul 11, 2012
I am writing a little OS agnostic library for my team for manipulating files.
One such function is used to move/rename files (only files, not dirs). I got into a little argument with a colleague about naming: "rename" or "move"?
"move" makes more sense, but the c api calls it rename.
Is there any historic (or actual) difference between a "rename" and a "move" we could base ourselves on? Or is this purely an Apples vs Oranges?
View 6 Replies
View Related
Aug 21, 2013
I am currently using Dev-C++ 4.9.9.2 compiler for creating a C project. I need few strings to be printed in a different color.
Code:
#include<stdio.h>
#include<conio.h>
int main(void)
{ textcolor(RED);
cprintf("Hello world
");
system("pause");
}
While I use " textcolor(RED) " it says: 'RED' undeclared, first use in this function.
If i make it: " textcolor(3) ", it says: [Linker error] undefined reference to textcolor & undefined reference to cprintf.
have been searching for a solution on google since morning. At last I could make out that it is not the correct compiler with suitable library or outdated <conio.h> header file.
I had switched from turbo(or borland, I don't remember) to Dev-C++ compiler due to some kind of library issue. Now I guess I'll have to switch to some other IDE. Which one is that, I don't know yet. There was another thread also about this topic, but didn't provide any solution.
Is there any method to upgrade certain header file (I don't think so)? What would be the best IDE with updated libraries?
View 7 Replies
View Related
Nov 8, 2014
I want to write a function called DrawLineSegments.This function must change the color of lines at every corner where the corner angle is greater than 60 deg (Assume that there is a function called checkangle). The color sequence must be black, red, green, blue, and repeat this sequence after the fourth color.
View 1 Replies
View Related
Jul 14, 2014
I want to use a new color for BaseColor in iTextSharp.
I can easily set a new color using RGB values from 0 to 255.
However, if I want to adjust the alpha value (and I know alpha ranges from 0 to 1), I can't make the alpha 0.5 because it's not an integer in the definition of BaseColor.
public BaseColor(int red, int green, int blue, int alpha);
So I can set my BaseColor like below:
static BaseColor newColor = new BaseColor(192, 192, 192);
but I can't use a non-int value for alpha. How can I easily convert double alpha values to integer values? What would be the range for alpha in int values and how do I, e.g., set the alpha value to 0.5 in int values?
EDIT: btw, I found online something like this: int alpha = (pixel >> 24). I don't understand why 24 and how can I break that into chunks I understand?
View 5 Replies
View Related
Sep 23, 2014
Implementing and manipulating a Polynomial ADT using a linked list.
So far I have:
poly_ADT.h
Code: typedef struct nodeT{
int coef;
int powr;
struct nodeT *next;
} node;
[Code]...
I need to create a function that creates the polynomial using input first.
poly *poly_create (num,...) ;return a new polynomial with num terms terms are listed in order of lowest ordered-term to highest. i.e., to initialize poly 15x^6 + -9x^4 + 3x^2 call poly_create(3, 3,2, -9,4, 15,6 );
Once I do that I need to implement various functions that can manipulate the polynomial itself but I'm having trouble just with creating the polynomial itself, how to do that using a linked list and nodes?
View 3 Replies
View Related
Dec 17, 2013
I have the following code and I am trying to do simple math calculations to the data. I need to take the car price (y) minus down payment (z) and then divide that quantity by 12 times "yearsx" That answer is then assigned to x. The problem is that x will not print the correctly!I also noticed that if I increase the "count" to amnything higher than the number on lines in the file, I get the correct value for x but only on the last set of the struct..my file reads as follows:
last_name first_name car_price down_payment years
johnson bill 10,000 2,000 3
When I printf the struct to the screen, i need to do the following:
x = (10,000 - 2,000)/(12*years);
but this is the math part that wont work. I have checked and doubled checked number types and I cant get it right.
Code:
#include<stdio.h>
#include<stdlib.h>
#define FILENAME "file.txt"
#define SIZE 100
}
[code]....
View 3 Replies
View Related
Mar 5, 2013
I need manipulating a set of containers. I created a vector that contained vectors of objects:
std::vector< std::vector<Terrain> > mapArray(num1, std::vector<Terrain>(num2));
where num1 and num2 are arbitrary numbers. and Terrain is the class of objects I'm trying to store.
I want to be able to use push_back on both the main vector and the vectors within the mapArray vector but I'm unsure of how to target the inner vectors with push_back. How to dynamically store a 2D array of objects.
View 10 Replies
View Related
Feb 17, 2013
I'm generating all ncurses color pairs like this
Code:
void generate_all_color_pairs(){ int foreground;
int background;
int i = 0;
for(foreground=0; foreground<8; foreground++){
for(background=0; background<8; background++){
i++;
[code]....
but according on several sources, some terminals suport more colors.Is there any way to determine how many colors the current terminal supports?
View 3 Replies
View Related
Oct 5, 2013
I want to detect colors that in the black rectangle. [URL] How can I do? What library should I use?
View 7 Replies
View Related
Jan 19, 2014
I'm trying to make colors transparent in c++ using a 3rd party library. I've successful made my background transparent but I feel I'm cheating by not understanding how I entered the value.
"0xff, 0xff, 0xff" is the color white but i'm not sure how it's the color white like with RGB values.
View 5 Replies
View Related
Aug 31, 2014
Basically I am making a console RPG (isn't every beginner nowadays?) and I am having an incredible amount of trouble assigning specific characters their own color. e.g. monsters being red, cash being green, etc.
I took out Left, Right, and Down controls because of character constraint.
#include <iostream>
#include <windows.h>
//%%%%%%%%%%%%%% COLOR CALL %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void setcolor(unsigned short color) {
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hcon,color);
[code]....
View 8 Replies
View Related
Mar 1, 2014
Why do most C examples pass a double pointer when manipulating linkedlists? Why can not we just pass a single pointer to the struct?I think using an external reference accessor for a linked list would be a more appropriate solution, yes or no?
View 1 Replies
View Related
Apr 22, 2013
I am currently starting to attempt to make a program that can move my cursor to certain colors on my monitor. The problem is this seems like it will be 10x harder than I first thought.
View 4 Replies
View Related
Jun 29, 2013
Suppose I have a txt file that I want the contents printed to the console in such a way that every five words are colored blue and the following five are red. How do I accomplish such a task? I am currently only able to print the contents of the file in regular color using ifstream.
View 1 Replies
View Related
Jul 15, 2014
I made my own custom message/dialog box.
I have a template mock up view using xaml. I have a viewmodel that raises the message property. I binded the message property to a textblock inside my xaml.
Since my messages are different for every viewmodel I have.
E.g.in every viewmodel, I have something like
messagewindow.Message = "This is a new message";
dialogService.ShowDialog(Success, messageWindow);
In one of my messages, I want to make the font bold and different color for a specific message segment.
How can I do that without messing up with the other messages that inherit from the xaml or code behind?
Currently, I'm not using any code behind and a lot of the examples online I've seen use code behind and/or don't have dynamic message textboxes.
View 5 Replies
View Related
Oct 6, 2013
My code is:
#include <iostream>
#include <string>
#include <cstdlib>
[Code]....
The problem is that the images don't display and the window doesn't respond.
View 5 Replies
View Related
Jan 29, 2015
What's the best performance library for loading images in PNG?
View 5 Replies
View Related
Feb 21, 2013
I want to import images in my program and what function I will use.
Compiler: Turboc 3.0
View 2 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
Jun 9, 2013
Since SDL doesn't have it's own function for rotating images and I'm tired of storing multiple angles of the same sprite in a file, I created my own function for doing so:
//XY Class
class XY {
public:
XY(){}
XY(float x, float y);
[Code] ....
The problem is while Spin does spin the surface correctly, some pixels are rotated to the same new position so gaps appear in the returned surface. I need a way of filling in the gaps so the returned image looks better. A link to a program I made that uses this function is below so you can see the problem that I'm talking about. [URL] ....
I currently use SDL 1.2. Could my problem be fixed if I used 2.0? For example, does SDL 2.0 have a built in function for rotating surfaces?
View 3 Replies
View Related
Feb 16, 2014
RLE(Run Length Encoding)
using namespace std;
class Bitwriter{
private:
[Code]....
View 1 Replies
View Related