1
0

cdrapp.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #include "cdrapp.h"
  2. // sr.ApplyUniformFill CreateCMYKColor(0, 100, 100, 0)
  3. bool fill_red(corel *cdr)
  4. {
  5. auto sr = cdr->ActiveSelectionRange;
  6. auto red = cdr->CreateCMYKColor(0, 100, 100, 0);
  7. sr->ApplyUniformFill(red);
  8. return true;
  9. }
  10. bool cql_OutlineColor(corel *cdr)
  11. {
  12. auto col = cdr->CreateCMYKColor(0, 100, 100, 0);
  13. auto s = cdr->ActiveShape;
  14. col-> CopyAssign(s->Outline->Color);
  15. col->ConvertToRGB();
  16. auto r = col->RGBRed;
  17. auto g = col->RGBGreen;
  18. auto b = col->RGBBlue;
  19. char buf[256] = { 0 };
  20. sprintf(buf, "@Outline.Color.rgb[.r='%d' And .g='%d' And .b='%d']", r, g, b);
  21. auto cql = _bstr_t(buf);
  22. // MessageBox(NULL, cql, "cql 轮廓颜色", MB_ICONSTOP);
  23. auto sr = cdr->ActivePage->Shapes->FindShapes(_bstr_t(), cdrNoShape, VARIANT_TRUE, cql);
  24. sr->CreateSelection();
  25. return true;
  26. }
  27. bool cql_FillColor(corel *cdr)
  28. {
  29. auto col = cdr->CreateCMYKColor(0, 100, 100, 0);
  30. auto s = cdr->ActiveShape;
  31. col-> CopyAssign(s->Fill->UniformColor);
  32. col->ConvertToRGB();
  33. auto r = col->RGBRed;
  34. auto g = col->RGBGreen;
  35. auto b = col->RGBBlue;
  36. char buf[256] = { 0 };
  37. sprintf(buf, "@Fill.Color.rgb[.r='%d' And .g='%d' And .b='%d']", r, g, b);
  38. auto cql = _bstr_t(buf);
  39. auto sr = cdr->ActivePage->Shapes->FindShapes(_bstr_t(), cdrNoShape, VARIANT_TRUE, cql);
  40. sr->CreateSelection();
  41. return true;
  42. }
  43. bool cql_SameSize(corel *cdr)
  44. {
  45. cdr->ActiveDocument->Unit = cdrMillimeter;
  46. auto s = cdr->ActiveShape;
  47. char buf[256] = { 0 };
  48. sprintf(buf, "@width = {%lf mm} and @height = {%lf mm}", s->SizeWidth, s->SizeHeight);
  49. auto cql = _bstr_t(buf);
  50. // MessageBox(NULL, cql, "cql 尺寸相同", MB_ICONSTOP);
  51. auto sr = cdr->ActivePage->Shapes->FindShapes(_bstr_t(), cdrNoShape, VARIANT_TRUE, cql);
  52. sr->CreateSelection();
  53. return true;
  54. }
  55. bool Shapes_Filp(corel *cdr)
  56. {
  57. BeginOpt(cdr);
  58. auto sr = cdr->ActiveSelectionRange;
  59. // CorelDRAW Shapes 物件 Item 编号从1开始
  60. for (auto i = 0; i != sr->Count; i++)
  61. sr->Shapes->Item[i + 1]->Flip(VGCore::cdrFlipHorizontal);
  62. EndOpt(cdr);
  63. return true;
  64. }
  65. bool Clear_Fill(corel *cdr)
  66. {
  67. cdr->ActiveSelection->Fill->ApplyNoFill();
  68. return true;
  69. }