|
Wish: to have the paramter src to of the function threadedblurfilter const.
--START CODE EXAMPLE--
#include <stdio.h>
#define _REENTRANT
#include <pthread.h>
#include <math.h>
#include "blurfilter.h"
#include "ppmio.h"
typedef struct
{
int xsize;
int ysize;
pixel *src;
pixel *dst;
int radius;
double *weight;
int ystart;
int yend; /*blurfilter calculates including this coordinate.*/
} blurinfo_t;
void *blurfilter(void *);
void threadedblurfilter(const int xsize, const int ysize, pixel *src, pixel *dst
,
const int radius, double *weight, const int nthreads)
{
blurinfo_t *blurinfo = (blurinfo_t *)malloc(nthreads * sizeof(blurinfo_t));
pthread_t *threadId = (pthread_t *)malloc(nthreads * sizeof(pthread_t));
int i, j;
int npixelsperthread = ysize / nthreads;
int ypos = 0;
int breakreached = 0;
for (i = 0; i < nthreads; i++)
{
if ((double)(ysize - ypos) / (double)(nthreads - i) ==
(ysize - ypos) / (nthreads - i) &&
breakreached == 0)
{
breakreached = 1;
npixelsperthread++;
}
blurinfo[i].radius = radius;
blurinfo[i].weight = weight;
blurinfo[i].xsize = xsize;
blurinfo[i].ysize = ysize;
blurinfo[i].src = src;
blurinfo[i].dst = dst;
blurinfo[i].ystart = ypos;
blurinfo[i].yend = blurinfo[i].ystart + npixelsperthread - 1;
pthread_create(&threadId[i], NULL, blurfilter, &blurinfo[i]);
ypos += npixelsperthread;
}
for (j = 0; j < nthreads; j++)
{
pthread_join(threadId[j], NULL);
}
free(threadId);
}
void *blurfilter(void *p)
{
blurinfo_t *blurinfo = (blurinfo_t *)p;
//Lots of heavy calculations.
}
--END CODE EXAMPLE--
|
|
|
|
|
how can i change edit font color???
|
|
|
|
|
if u r using a DC to output u'r text, then u can change u'r font color by setting DC's SetTextColor property
Ashok Singh
<west end="" india="">
|
|
|
|
|
Use CDC::SetTextColor in CWnd::OnCtlColor . I think there are some good articles explaining this on CP.
Cheers
/moliate
|
|
|
|
|
//this is how i set the size and the ==== bold
//setting edit box yfont size
LogFont.lfHeight = 15;
LogFont.lfWeight = FW_BOLD;
newFont.CreateFontIndirect(&LogFont);
GetDlgItem(IDC_EDIT1)->SetFont(&newFont);
CEdit* smpEdit = (CEdit*)GetDlgItem(IDC_EDIT1);
smpEdit->SetWindowText(afileName);
|
|
|
|
|
Read Mike Dunn's FAQ. It will answer 50% of all commonly asked questions.
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
how to make a Item in CTreeCtrl invisible.
Thank you!
|
|
|
|
|
Delete it or create your own tree control.
|
|
|
|
|
since you know about ctreectrl let me please ask one question
do you know what is wrong in the following code? i mean.. i'm trying to sort the files by name, by type,by size, or by date (based on user choice). so i have to use SortChildrenCB() instead of SortChildren().
but the callback function is never got excuted.
do u know why?
|
|
|
|
|
since you are using ctreectrl let me please ask one question
do you know what is wrong in the following code? i mean.. i'm trying to sort the files by name, by type,by size, or by date (based on user choice). so i have to use SortChildrenCB() instead of SortChildren().
but the callback function is never got excuted.
do u know why?
|
|
|
|
|
ShowWindow( SW_HIDE ) should workk.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
NO,i want invisible a one Item,no a whole Windows.
|
|
|
|
|
jieg wrote:
NO,i want invisible a one Item,no a whole Windows.
You could overide the on item draw notification and draw something to indicate the item isn't available.
Other than that I don't think this is possible. You either need to remove the item from the tree control or possibly write your own tree control.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
i have a application that prints all kinds of files using shellexecuteex(). the program printed a:\one\k.jpg and a:\one\m.tif yesterday... but right now when i using my application to print same two files again, the following error message pops up.
" a:\one\k.jpg is not valid to win32 application"
and
" a:\one\m.tif is not valid to win32 application"
why both of them print before and not now.. i could not find the reason..
please answer me if you know the reason.. thanks
|
|
|
|
|
Can you post the relevant code snippets, please?
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
//here how i print the file.
//calling print function and passing the file name to print.
print("c:\one\k.jpg");
void print(CString fileName)
{
SHELLEXECUTEINFO lpExecInfo;
CString print = "print";
SetShellExecuteInfoStructure(lpExecInfo,print,fileName);
int success = ShellExecuteEx(&lpExecInfo); // printing a file
if(success == 0)
MessageBox("Fail");
}
void SetShellExecuteInfoStructure(SHELLEXECUTEINFO &lpExecInfo,CString lpVerbToPrintOrOpen, CString lpFile)
{
const char* verb = lpVerbToPrintOrOpen;
lpExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
lpExecInfo.lpFile = lpFile;
lpExecInfo.fMask=SEE_MASK_DOENVSUBST|SEE_MASK_NOCLOSEPROCESS ;
lpExecInfo.hwnd = NULL;
lpExecInfo.lpVerb = verb;
lpExecInfo.lpParameters = NULL;
lpExecInfo.lpDirectory = NULL;
lpExecInfo.nShow = SW_SHOW;
lpExecInfo.hInstApp = (HINSTANCE) SE_ERR_DDEFAIL ; //WINSHELLAPI BOOL WINAPI result;
}
|
|
|
|
|
Win wrote:
print("c:\one\k.jpg");
This can be achieved in a lot simpler manner as follows :-
ShellExecute(this->m_hWnd,"print",
"c:\\one\\k.jpg","","",
SW_HIDE);
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
no.. i can't use it because my application is printing program.. i have to print tons of files (any kinds of files). it has to be sent one file after printed one file. otherwise, the file will not be in order. so i need to know whether current file is finish printing and if finished, send another file. otherwise, wait until the first file is completely printed. so i have to use shellexeuteex(). and i suprised, it was fine printing .jpg and .tif files until yesterday and only starting from yesterday, could not print .jpg and .tif files.. i can't find the reason why can't print. do you have any idea why???
|
|
|
|
|
Win wrote:
do you have any idea why???
Because you are using \ instead of using \\ in your file name strings
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
Hi all... i have an application,which include, checkboxes, radio buttons and tree controls that's act like window explore.
i want to save the user current setting so next time when the user rebrowse the folder he/she browsed last time.
how can i do that.????
thanks
Win
|
|
|
|
|
Save them in a file or the registry.
|
|
|
|
|
but how.. how can i save in the file or register???
i have no idea...
|
|
|
|
|
Have a look at the articals on CP for streaming to the registry... just make up values that mean certain thing and then check from them in your program. Or just output to a file. Have a look at MSDN under <fstream>
Now taking suggestionsfor a new sig. please email me all suggestions.
|
|
|
|
|
if you dont mind, can you gvie me add for them please... so far i could not find in the mfc lib yet..
|
|
|
|
|