C++ :: Detect Colors In The Black Rectangle?
Oct 5, 2013I want to detect colors that in the black rectangle. [URL] How can I do? What library should I use?
View 7 RepliesI want to detect colors that in the black rectangle. [URL] How can I do? What library should I use?
View 7 RepliesI'm trying to create a PPM image for a class assignment. A black rectangle with a circle at the point 225, 175 with a radius of 75. I have to use certain specific methods, so I can't use like Bresenham's really famous method for creating a circle.
The problem is that it compiles fine, and transfers to an image fine, but always says that I have a negative or zero image size.
Code:
#include "shapes.h"
int main () {
int i, j, x, y;
fprintf(stdout,"P6 width height 255
");
[Code] ....
And my header is:
Code:
#include <stdio.h>#include <math.h>
#define height 480
#define width 640
#define cy 175
#define cx 225
#define radius 75
The circle has to be filled in. I made it white. Also, i and j are unsused so far, so just ignore them.
Consider I have a rectangle like this:
Point p1(100,100);
Point p2(300,200);
Graph_lib::Rectangle r(p1,p2);
And also I have a function that takes a rectangle and returns a Point of that, say, top-left corner of that rectangle. For example:
Point N(Graph_lib::Rectangle R1);
My question is that, first, how to send that Rectangle r(p1,p2) to the Point N(Graph_lib::Rectangle R1) function? And then, how to return a Point from that function?
My IDE is visual studio 2012.
How to make a red and black tree using SFML ....because i really need...I really don't know how to use SFML i only know how to use win32 console.
View 3 Replies View RelatedRed Black Trees. [URL] .....
My app keeps crashing after about the 49th insert.
I tried debugging and it keeps pointing to this area in the Fixup:
if (z->parent == z->parent->parent->left) {
y = z->parent->parent->right;
I've been working on my deletion function for Red and Black trees but can't seem to get it to work. From what I can tell, the remove function, instead of deleting the single value that will my prompt by the user, will delete all the values that are in the red and black tree.
Code:
bool RedBlackTree::remove(int x) {
if(!search(x)){
return false;
} else {
Node* z = new Node(x);
rbremove(z);
[Code] ....
creating a bitmap. Our professor wants us to creat a black 100*100 bitmap.
Code:
#include <stdio.h>
#include <stdlib.h>
#pragma pack(push,2)
typedef struct{
[Code].....
I dont even know where to start. I spend the last 7h infront of my computer and i'm so frustrated cause my professor gave us no information what so ever. At the moment its more of a trial and error process than anything else.
How would i set the color of an individual pixel for examplel or how would i save the file ?
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?
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 RelatedI 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?
I tried to write a code to calculate black body spectra over an user-entered range of wavelength and temperatures. The equation I'm trying to code is the second one this image (stolen from Wikipedia)The syntax to run it is bbgrid lambda_inic lambda_final temp_inic temp_final inc_T inc_lambda
where bbgrid is the name of the program, lambda_inic and lambda_final are the limits of the wavelenght range (in units of angstroms, 1A=10⁻⁰m), temp_inic and temp_final are the limits of the temperature range (in Kelvins) and inc_T and inc_lambda are the increments. What I want to do is, given the ranges of temperatures and wavelengths, to run the code over the lambdas and the temperatures.
The problem is that the behaviour of the intensities (what I'm calculating) is erratic. Sometimes it is highly positive, sometimes immensely negative and turning between those two. As an example of an output file, I'm getting things like this:
3100 1915076038
3110 -1233496775
3120 1741010116
3130 1229780625
3140 421722788
3150 -1874760945
3160 1654746252
3170 1062468321
3180 -795217626
3190 -1141129750
3200 -1570716956
3210 539385985
While I was trying to debug the code, I found the problem may reside in the exponential factor in the denominator. I wrote some lines to calculate and print on the screen only the exponential, and it was oscillating like crazy. The output file should produce curves like this:
Code:
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
[code]....
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?
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].....
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.
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]....
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 RelatedSuppose 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 RelatedI 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.
Current compiler doesn't have correctly defined debugger!
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
ToDoList: Warning: No to-do types or comment symbols selected to search for, nothing to do.
Create new parser for project 'Test'
Project 'Test' parsing stage done!
It is my first time in use lock detect so i didn't now how to start.
how to define the lock detect?
i was trying to write a program in c language which can detect mouse movement, but the program which i have written can only detect the mouse click or scroll the program which i have written given below..
Code:
#include<stdio.h>
#include<string.h>
#include <ncurses.h>
int main() {
}
[code]....
run the programme with linked-lncurses. improve my program which also detect when the mouse moves.
I am using scientific linux. In the directory user/project/Build, after I ran 'make' to compile and link all the cpp files,I had no problems. But then, when I went to directory user/run/run.sh, which runs the project binary in user/project/Build/bin/project, I get a segmentation fault error. In the directory user/run, I enter 'gdb' in the command prompt and get the message "*** No targets specified and no makefile found. Stop." What am I supposed to do to detect the segmentation fault?
View 2 Replies View RelatedHow would I detect if any letter key is pressed. Would I have to use GetAsyncKeyState() for every letter key? Or could I have some kind of loop going through all the hexadecimal values for every letter? I don't know how I would go through hexadecimal values with a loop.
View 6 Replies View Relatedi build an application, that makes the used memory growing. i don't get any error(unless, i believe, that i use some memory value(i don't know the value), but i see the memory growing very slowly. how can i detect the memory leak?
View 4 Replies View Relatedthe code draws rectangle or square it depends on you (column,row) then, put number in the center of the rectangle i don't want to extra space after putting one,two,three or four digits number in the center of the rectangle
#include <stdio.h>
int main(){
int i,j;
[Code]....
Is it possible to create a programme which would detect and change word endings? I would like to write a simple verb conjugator, i.e.:
If you enter a word ending with AAA then I would like the programme to show, say, six modified words:
Word with the replaced ending, for example QWERTYAAA changes into QWERTYBBBQWERTYAAA changes into QWERTYCCCQWERTYAAA changes into QWERTYDDD etc.
Is it possible to do it? If so, how?